Building Select Queries Using QBE
Building Select Queries Using QBE
A select query is the most common type of query. It retrieves data from one or more
tables and displays the results in a datasheet where we can update the records (with some
restrictions). A datasheet displays data from the table(s) in columns and rows, similar to a
spreadsheet. A select query can also group records and calculate sums, counts, averages,
and other types of total.
As stated in the previous section, simple select statements can be created using the
Simple Query Wizard. However, in this section we demonstrate the building of simple
select queries from scratch using Design View, without the use of the Wizards. After reading
this section, the interested reader may want to experiment with the available Wizards
to determine their usefulness.
When we begin to build the query from scratch, the Select Query window opens and
displays a dialog box, which in our example lists the tables and queries in the DreamHome
database. We then select the tables and/or queries that contain the data that we want to add
to the query.
The Select Query window is a graphical Query-By-Example (QBE) tool. Because of its
graphical features, we can use a mouse to select, drag, or manipulate objects in the window
to define an example of the records we want to see. We specify the fields and records we
want to include in the query in the QBE grid.
When we create a query using the QBE design grid, behind the scenes Microsoft Office
Access constructs the equivalent SQL statement. We can view or edit the SQL statement
in SQL view. Throughout this chapter, we display the equivalent SQL statement for
every query built using the QBE grid or with the help of a Wizard (as demonstrated in later
sections of this chapter). Note that many of the Microsoft Office Access SQL statements
displayed throughout this chapter do not comply with the SQL standard presented in
Chapters 5 and 6.
A select query is the most common type of query. It retrieves data from one or more
tables and displays the results in a datasheet where we can update the records (with some
restrictions). A datasheet displays data from the table(s) in columns and rows, similar to a
spreadsheet. A select query can also group records and calculate sums, counts, averages,
and other types of total.
As stated in the previous section, simple select statements can be created using the
Simple Query Wizard. However, in this section we demonstrate the building of simple
select queries from scratch using Design View, without the use of the Wizards. After reading
this section, the interested reader may want to experiment with the available Wizards
to determine their usefulness.
When we begin to build the query from scratch, the Select Query window opens and
displays a dialog box, which in our example lists the tables and queries in the DreamHome
database. We then select the tables and/or queries that contain the data that we want to add
to the query.
The Select Query window is a graphical Query-By-Example (QBE) tool. Because of its
graphical features, we can use a mouse to select, drag, or manipulate objects in the window
to define an example of the records we want to see. We specify the fields and records we
want to include in the query in the QBE grid.
When we create a query using the QBE design grid, behind the scenes Microsoft Office
Access constructs the equivalent SQL statement. We can view or edit the SQL statement
in SQL view. Throughout this chapter, we display the equivalent SQL statement for
every query built using the QBE grid or with the help of a Wizard (as demonstrated in later
sections of this chapter). Note that many of the Microsoft Office Access SQL statements
displayed throughout this chapter do not comply with the SQL standard presented in
Chapters 5 and 6.
Building Select Queries Using QBE
Reviewed by Shopping Sale
on
09:22
Rating:
No comments: