In MS Access, what is a query?
This series of articles on MS Access Queries will start off from raw basics. Most of my regulars will already know this material, and so please allow for the fact that this is meant for “newbies” to some degree. I promise to get into more challenging topics as we go along.
Simply put, a query is a question asked of the database, specifically of one or more of the tables in the database. A query’s answer returns values from selected fields (columns) and records (rows).
A basic example could be, “Which of our customers are located in Springfield?”
A more complex query (or question) could be, “Which of our customers in Springfield have not ordered any products in the past 6 months?”
The above examples are of just one type of query; the select query. MS Access has a number of types of queries available.
This series of articles will be written based on Access 2000. Newer versions of Access may have added to this list. The principles explained here should work fine on version 2000 and any newer ones.
Types of Queries
If you create a query manually (more on this later) you choose from a list of 6 query types.
- Select Query retrieves data from one or more tables (or queries!)
- Crosstab query displays summarized data in a column/row format (like pivot tables in Excel)
- Make Table query creates a new table based on data from one or more existing tables (or queries!)
- Update query updates the data in a table (a simple example would be “Add an across the board raise of 2% to each employee’s pay rate”)
- Append query adds new records (rows) to a table
- Delete query will delete records (rows) from a table
Most of the above queries accept criteria (parameters) such that only some of the records in a table are retrieved or updated.
NEXT: How to create a basic query.