129
CHAPTER
Selecting Data with
Queries
IN THIS CHAPTER
Understanding what queries are
and what they can do for youCreating queriesSpecifying the fields in a queryDisplaying a query’s resultsAdding and removing fields
from a query’s designSorting a query’s resultsFiltering records returned by a
queryPrinting records returned by a
querySaving a queryIncluding more than one table
in a queryAdding, deleting, and moving
tables in a queryJoining tables in a query’s
designUnderstanding the options for
joining tables in a queryQ
ueries are an essential part of any database application. Queries are
the tools that enable you and your users to extract data from multi-
ple tables, combine it in useful ways, and present it to the user as a
datasheet, on a form, or as a printed report.
You may have heard the old cliché, “Queries convert data to information.”
To a certain extent, this statement is true — that’s why it’s a cliché. The data
contained within tables is not particularly useful because, for the most part,
the data in tables appears in no particular order. Also, in a properly normal-
ized database, important information is spread out among a number of dif-
ferent tables. Queries are what draw these various data sources together and
present the combined information in such a way that users can actually work
with the data.
In this chapter, you learn how to create and enhance queries. Using the Sales
(tblSales), Customers (tblCustomers), Contacts (tblContacts),
Sales Line Items (tblSalesLineItems), Categories (tblCategories),
and Products (tblProducts) tables, you create several types of queries for
the Collectible Mini Cars database.
On the CD-ROM
This chapter uses the Chapter04.accdb database. If you haven’t already
copied it onto your machine from the CD, you should do so now.
The data returned by Access queries is often used to populate forms and
reports. As you read this chapter, keep in mind that the transformations and
conversions imposed on data returned by a query apply whether the data is
viewed in a datasheet, in a form, or in a report. One of the underlying princi-
ples of queries is that the work performed by a query is independent of how