4.3: Selection Query

Suppose we want a list of paperbacks. That is, we want to list information about books where the paperback field has a value Yes. Requirements like this are placed on the criteria line of the pertinent field(s).

To develop this query we need to select the Book table and then add its’ fields to the grid.

For the paperback field we also enter the value Yes on the criteria line:


                           Figure 4.10: Query with selection criteria

When we run the query we get results listing paperbacks:


                                                Figure 4.11: Query results

When a query runs, the query processor accesses the underlying table(s) and displays results where the data meets the criteria specified. For a query accessing a single table consider that the query processor is performing these actions:

For each row in the table:

        • retrieve the row from the database
        • test the row to see if it meets the criteria specified
          • if the row meets the criteria then display the fields marked for show


Save your query as paperbacksQuery. This is a selection query that selects, according to criteria, specific rows for display; this type of query produces a horizontal subset of a table.

Most queries are a combination of selection and projection. It is typically the case that queries will select a subset of fields for display and criteria will be needed to constrain the rows retrieved.

Share This Book