Asking your database questions
Building a Single Table Query
1. Open the database that you want to look at and then click the Queries button on the left side of the screen. For this example, open Gardening.mdb.
2. Decide what question you're asking with the query, which fields you will need to answer that question and what fields you want in your output.
3. Double-click Create query in design view.
4. In the Show Table dialog box, click the table you want to use and then click Add. Click Close.
For this example, add the Products Table.
5. Select the first field for your query by clicking the down arrow in the Field box. Then click the name of the field in the drop-down menu. Repeat with additional fields as needed.
For this example, select Product Name, Price per Unit, Description and Available.
6. To sort the query by a certain field, click in that field's Sort box, click the down arrow, and select Ascending or Descending.
For this example, sort by Product Name (ascending).
7. If you don't want a field to appear in the results, uncheck the Show Box for that field.
For this example, click-off the Show Box for Available.
8. Enter the criteria for each field that's part of the question.
9. Save your work using File>Save. For this example use "Available Products".
10. Click the Run button!
Building a Multiple Table Query
1. Open the database that you want to look at and then click the Queries button on the left side of the screen.
2. Decide what question you're asking with the query, which fields you will need to answer that question and what fields you want in your output. For this example, we want to create a query that shows all heirloom tomatoes that are available for purchase. the query should display the product name, price per unit, description and supplier.
3. Double-click Create query in design view.
4. In the Show Table dialog box, click the table you want to use and then click Add (or just double click on the name of the table). Continue until you have added each table you want to use. Click Close.
5. Add each you field to the query by double clicking on the name of the field.
6. To sort the query by a certain field, click in that field's Sort box, click the down arrow, and select Ascending or Descending. (You may sort on multiple fields. Sorts are performed from left to right.)
7. If you don't want a field to appear in the results, uncheck the Show Box for that field.
8. Enter the criteria for each field that's part of the question.
9. Save your work using File>Save. For this example use "Available Heirlooms".
10. Click the Run button!
Basic Comparison Operators
Name | Symbol | What it Means | Example |
Equals | (none) | Displays all records that exactly match whatever you type. | |
Less Than | < | Lists all values that are less than your criterion. | |
Greater Than | > | Lists all values in the field that are greater than the criterion. | |
Greater Than or Equal To | >= | Works just like Greater Than, except it also includes all entries than exactly match the criterion. | |
Less than or Equal To | <= | works the same as Greater than but uses criterion Less Than or Equal To | |
Not Equal To | <> | Finds all entries that don't match the criteria. |