Datasheet

What is a query?
By definition, a query is a question. For our purposes, it is a question about
data, which is stored in tables. Queries can be exceedingly simple, like asking
what all of the data in a table is. Queries can also be quite complex, testing for
different criteria, sorting in certain orders, and performing calculations. In
Access, two main types of queries exist: select and action queries. Select
queries are perhaps the most common type. This query simply asks a question
of the data and returns the results. No changes are made to the data whatso-
ever. You can always run select queries and never worry that the actual data is
being altered. Action queries actually manipulate and change the data in a
table. The action query can add records, delete records, or change information
in existing records (updating). This type of query is discussed more fully in
Chapter 2.
NOTE Keep in mind that the results of a query are separate from the query
itself. The query is simply the question, not the results of the question. If the
data in the table is changed and the query is run again, you could get different
results. The results of a query are not located in a separate table that exists in
Access. The results come directly from the table that is being queried. You have
separated the raw data from the questions that you would like to ask of it.
Creating a select query
Quite often, when you are working with or analyzing data, it is preferable to
work with smaller sections of the data at a time. The tables contain all the
records pertaining to a particular entity, but perhaps for your purposes you
need to examine a subset of that data. Typically, the subsets are defined by cat-
egories or criteria. The select query enables you to determine exactly which
records will be returned to you.
If you thought that creating queries required learning a programming
language or some other technological hurdle, that is not entirely accurate.
Although it is possible to create queries using the programming language of
databases—SQL—it is much more easy and intuitive to use the Query By
Design (QBD). The Query By Design is a graphic user interface where the
tables and columns are visually represented, making it easy to visualize the
“question” you would like to ask of the data.
Access Basics 25
05_59978X ch01.qxp 12/1/05 7:46 PM Page 25