Theory question 104
Database ManagementPaper 2, Section A: Essay
(a) Outline the steps involved in creating the Query By Example (QBE) in figure 1 assuming the table tblcustomer exists already. (b) Write the steps to generate the SQL statement for the action in 4(a).

Show the model answer
(a) Open the database in MS Access; click Create → Query Design; add tblcustomer and close the Show Table box; double-click (or drag) Lastname, Firstname and Town into the grid; tick Show for all three; in the Criteria row under Lastname type Like 'John'; save the query and click Run.
(b) With the query open, click View → SQL View; the SQL statement is shown:
SELECT tblcustomer.Lastname, tblcustomer.Firstname, tblcustomer.Town FROM tblcustomer WHERE tblcustomer.Lastname Like 'John';
Copy the field names, table and criterion exactly from Figure 1.