Queries are used for multiple purposes in a database environment. They can be used directly to
- restrict the information a user can see,
- as the basis of a MS Access form,
- as the basis of a MS Access report.
In this chapter we use the Library database for examples. With MS Access you can create a query in multiple ways; we will examine the use of the Query Designer. To create a query, click the Create tab and then click the Query Design icon:
As a result, MS Access opens a Query By Example (QBE) window:
This window comprises two areas: Relationships and Grid. The Relationships area will show each table that needs to be accessed and the relationships to be used with those tables.
The Grid area is used to specify:
- fields and tables,
- sort fields,
- fields to be included in the results display,
- criteria fields must meet for a row to be included in the query result,
- grouping of rows for displaying summary information
We use the Library database; we start with simple examples and work our way to more complex situations.