| Lesson 2 | What are queries? |
| Objective | Describe how queries can enhance the analysis of your data in Access |
In Microsoft Access, a query is the primary tool you use to analyze data. Rather than browsing entire tables, you define a question—“Show me only these rows, with these fields, in this order”—and let Access assemble a result set for you. This result set is dynamic: each time you run the query, it uses the latest data stored in your tables.
When you save a query, you are really saving a query definition (the question) rather than a copy of the data itself. The same query definition can be reused for ad hoc analysis, printed reports, or as the data source behind forms and dashboards.
Queries give you a structured way to explore your data without changing the underlying tables. They help you:
For example, you might start with simple questions like:
As you gain experience, those questions evolve into richer analyses—trending over time, segmenting by customer type, or identifying exceptions that need attention.
A typical select query (the most common type used for analysis) answers four main questions:
In Query Design view, these elements appear in the upper pane (tables and joins) and the lower grid (fields, sort order, and criteria). Behind the scenes, Access represents your design with SQL.
SELECT Projects.ProjectID,
Projects.ProjectName,
Customers.CompanyName,
Timesheets.WorkDate,
Timesheets.HoursWorked
FROM (Projects
INNER JOIN Timesheets
ON Projects.ProjectID = Timesheets.ProjectID)
INNER JOIN Customers
ON Projects.CustomerID = Customers.CustomerID
WHERE Customers.CompanyName = "Dynamic Solutions"
ORDER BY Timesheets.WorkDate;
You do not need to write SQL by hand to use queries, but understanding that your design translates into SQL helps you reason about which records are included and why.
Criteria rows in Query Design view let you narrow a large dataset down to only the records that matter for a particular question. Examples include:
You can combine criteria with AND and OR logic, use wildcard searches (for example, all customers whose names start with “A”), and parameter prompts that ask the user for a value at run time.
Queries also support aggregate functions—such as SUM, AVG, COUNT, MIN, and MAX—so you can turn detailed records into summary views. For example, you can show:
In Query Design view, you use the Totals button to add a “Total” row and choose how each field should behave (Group By, Sum, Count, and so on).
A crosstab query summarizes data in a grid layout that is similar to an Excel PivotTable. For example, you can display project names down the left side and months across the top, with total hours in each cell. This layout makes trends and outliers much easier to spot than a long list of rows.
Crosstab queries are especially helpful when:
Queries allow you to add calculated fields that do not physically exist in any table. These expressions can perform arithmetic, date calculations, or text concatenation. For example:
FullName: [LastName] & ", " & [FirstName]
BillableAmount: [HoursWorked] * [BillingRate]
DaysOpen: Date() - [OpenedDate]
Calculated fields are a key way queries enhance analysis: they let you move from raw storage fields to meaningful business measures without changing table structures.
Once you have a query that returns exactly the data you need, you can reuse it:
This reuse is an important part of good design: you centralize logic in a query definition instead of duplicating it in multiple places.
While this module focuses on queries for analysis, Access also supports action queries that change data:
Action queries are useful for maintenance work and bulk changes, but they should be used carefully—especially in shared databases—because they can affect many rows at once. For analytical workflows, you will typically stay with select and crosstab queries, and use action queries only when you intentionally need to reshape or archive data.
Many Access applications connect to SQL Server or Azure SQL Database. In these scenarios, some or all of the query processing can be pushed to the server for better performance. You can:
When writing T-SQL for a pass-through query, remember that the syntax follows SQL Server rules. For example:
LIKE is %, not *.'Dynamic Solutions'.Being aware of these differences ensures that your analyses remain accurate when they span Access and SQL Server.
Whether you are working with a simple desktop database or a front end linked to SQL Server, queries are the key to turning raw tables into meaningful information. By combining tables, filtering and sorting, summarizing with totals and crosstabs, and adding calculated fields, you can answer questions that would be difficult or impossible to solve by looking at individual tables alone.
In the next lessons of this module, you will design and run your own Access queries so you can see how each of these analysis techniques works in practice.