In Access queries let you retrieve information from one or more tables on a set of defined search conditions. Learn how to use queries in Access here.
Planning a query
There are three questions you need to answer when planning a query:
- What do you want the results to look like? Identify every bit of information—or field—you want included in the results.
- Where is the information stored in the database? List which tables—and/or queries—hold the information you want to see.
- What conditions do you want the data to meet? This helps determine how to set the criteria so Access can search the records properly.
Planning: Which customers ordered technology books?
Let's think about this process for our bookstore database scenario. We have a new technology series coming out soon, and we want to send coupons to customers who have ordered technology books from us in the past. A query can help us answer the question, Which customers have ordered technology books from us already? Let's use the three-question process to plan this query.
- What fields do we want to see in the results? We need a list of customer names and addresses in order to mail the coupons to our customers, so we'll need the results to show the categories below:
Fields in Results
- In which tables is the information stored? For this query, we'll need:
- The Customers table to get customers' names and addresses
- The Books table to know which books are technology books
- The Orders table to know which customers ordered those books
- What is the condition we want the data to meet? We want Access to look for only the books where the book's category is technology.
Criteria of the Query Condition