Process queries that involve a virtual table

This section describes various options for processing a SELECT statement, or query, that involves a virtual table.

An SQL query requests that the database server fetch and assemble stored data into rows. A SELECT statement often includes a WHERE clause that specifies the values that a row must have to qualify for selection.

Depending on the specifications in the query, the returned data might contain the entire stored table or particular columns and rows. The Projection clause lists the columns that make up the projection. An efficient access method returns values for projected columns only. The WHERE clause specifies the values that qualify a row for selection. An efficient access method formats and returns only those rows that contain the selected values.

The following query projects the values in the particular columns name and department and selects the particular rows that contain the value Manager in the title column. The query does not include title in the projection.
SELECT name, department FROM employee 
   WHERE title = 'Manager'
Query processing involves the following actions:
  • Assessing the cost of the requested scan for the optimizer
  • Interpreting the scan and qualification descriptors
  • Scanning the table to select rows
  • Returning rows that satisfy the query