Access 2007
Using Queries to Make Data Meaningful - Part 1
Planning a query
There are three questions you need to answer when you are planning a query:
- What do you want the results to look like? Identify every field or bit of information that 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:
Fields in Results - In which tables is the information stored? For this query, we'll need:
- Customers table—to get customers' names and addresses
- Books table—to know which books are technology books
- 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