Microsoft Office Tutorials and References
In Depth Information
Querying: The Basics
Comparison Operators for Filtering and Querying
<10, any number smaller than ten
Less than or
<=10, ten as well as any number smaller than
>10, any number larger than ten
or equal to
>=10, ten as well as any number equal to or
larger than ten
=10, ten — not any other number
Not equal to
<>10; all numbers except ten (instead of <>,
you can enter the word not )
Between . . .
And . . .
Between 10 And 15, a number between 10 and
15 or equal to 10 or 15
Querying: The Basics
Querying means to ask a question of a database and get an answer in the
form of records that meet the query criteria. Query when you want to ask a
detailed question of a database. “Who lives in Los Angeles and donated more
than $500 last year?” is an example of a query. So is, “Which orders were
purchased by people who live in California and therefore, have to pay sales
tax, and how much sales tax was charged with these orders?” A query can
search for information in more than one database table. For that matter, you
can query other queries for information. A query can be as sophisticated or
as simple as you need it to be. In the results of the query, you can show all
the fields in a database table or only a few necessary fields.
Access offers several different ways to query a database (the different
techniques are described later in this chapter in “Six Kinds of Queries”). Still,
no matter which kind of query you’re dealing with, the basics of creating
and running a query are the same. You start on the Create tab to build new
queries. To open a query you already created, double-click its name on
the Navigation pane. The following pages introduce you to queries, how to
create them, and how to modify them.
Creating a new query
To create a new query, start on the Create tab and click the Query Design or
Query Wizard button.
✦ Create the query in Design view: Click the Query Design button to see the
Query Design window, as shown in Figure 4-4, as well as the Show Table
dialog box for telling Access which database tables to query. Construct
your query in the Design window (the following pages explain how).