Goodwill Community Foundation creating
opportunities for a better life one of
the most powerful ways of analyzing your
data and access is by creating a query
running a query is like asking your
database a question a query can retrieve
data from a single table or from
multiple tables and it all depends on
how complex your question is in this
video we're just going to focus on
making a simple query that uses a single
table and this is sometimes called an
advanced filter let's suppose our bakery
has an upcoming event and I want to get
a list of all of our customers who live
nearby so we can send them invitations a
query is going to be able to go into the
customers table and find the names and
addresses of the nearby customers to
create a query go to the create tab and
then click the query design command
and then you'll need to select the table
or tables that you want to retrieve the
data from we're just using the customers
table for now click Add and then you can
close this window when working with
queries there are a couple of different
views that we're going to use if you
click on the view drop down arrow then
you can see that we are in design view
when we finish the query we're going to
be viewing the results in datasheet view
and you can use this menu to switch
views whenever you want the customers
table appears as a small window in the
object relationship pane which is this
area here and it has a list of all of
the fields that are in this table such
as first name last name and street
address and I'm going to resize it so I
can see all of the fields what we're
going to do is double-click each field
that we want to include in the query we
need the customers name and address so
we'll double click on the first name
last name street address city state and
zip code and we're not emailing or
calling them so we don't need those
fields each field now appears in the
area below which is called the design
grid below the field names is the table
row which shows which table each field
comes from and this will become more
important when we start dealing with
multiple tables and we're going to
modify some of these blank cells to
refine our query we want the results to
be sorted by last name so in the sort
row we'll click the cell under last name
and a drop-down arrow will appear you
can click it and then choose how you
want it to be sorted
next we're going to use the criteria row
to filter the records so that it's only
showing the customers who live nearby
first of all we want to send invitations
to everyone who lives in Raleigh so
we'll type Raleigh in the city column
and since we're looking for an exact
match it will need to be in quotation
marks so far this query will show all of
the customers who live in Raleigh but
none of the customers in other cities
but one of the ZIP codes in Cary is
close to Raleigh and let's say we'd like
to send those customers an invitation as
well to do this we're going to need to
add another criteria under zip code
instead of using the criteria row we're
going to use the row below it which is
the or row we'll type 2 7 5 1 3 in
quotation marks so now the query will
show customers who are in Raleigh or in
zip code 275 1 3 now the reason why we
didn't put them both on the same line is
that the customers would then need to
meet both criteria in other words the
customer would need to live in Raleigh
and in zip code 275 1 3 in some cases
you may want that but in this example it
will not give us the correct results
now we're finished designing this query
and the final step is to run it click
the run command on the design tab and
the results will instantly appear in
datasheet view which looks exactly like
a table
if you scroll through the results you
can see that each customer lives either
in Raleigh or in zip code 275 1 3 if you
want to make any changes to the query
you can click the view drop down arrow
and go back to design view and just like
any object it's a good idea to save it
I'll call it nearby customers this was
just a basic example and in the next
video we're going to talk about how to
make a query with multiple tables you
may want to practice this one a few
times before you go on to make sure that
you're comfortable with the process