Introduction to Queries
Queries select records from one or more tables in the same database so that they can be manipulated on the same datasheet. The resulting datasheet, called a dynaset, short for dynamic subset, is saved as an object and can be used again in the future. Queries are automatically updated whenever the original tables are modified. There are four types of queries:
- Simple Queries extract data from tables based on values specified in the Criteria Box.
- Crosstab Queries creates a crosstab that displays data in a spreadsheet.
- Find Duplicate Queries display records with duplicate values in one or more of the fields specified.
- Find Unmatched Queries display records from one table that do not have a corresponding value in a second table.
The Query Wizard will guide you through the creation of the query. The Query Wizard is found on the Create tab.
- Choose which type of query you would like to create on the first window. Simple Query Wizard is the simplist to construct.
- Choose the table you wish to use in your query under Table/Queries.
- Move the fields you want included in your query over to the right.
- In the next window name your new query and click finish.
To add criteria to your query, switch to Design View. Click on the Criteria field and enter a query experession. After you are finished adding criteria, click Run on the ribbon under Design.Common Expression Operators
- ? - takes the place of a single character and allows you to search for expressions where a character can vary
- * - takes the place of multiple characters
- < - less than a specified value
- > - greater than a specified value
- >= - greater than or equal to a specified value
- <> - not equal to
- Between # and # - replace the # with two numbers to search within that range of numbers
- Is null - finds all records with no value
- Is not null - finds all records with a value
- Like "a*" - finds all words beginning with the letter a
- And - used to search with more than one criteria at the same time
- Or - search for one value or another