Create a query in Access: your first select query
A query is a saved question to your data: which fields, which records, in what order? Once created, it returns the current state every time you open it.
In short: Create, Query Design, add the table. Each field goes into a column of the grid. In the Sort row choose Ascending or Descending. Run shows the result, Ctrl+S saves the query.
Before you start: Sort and filter in Datasheet view.
Try it now
The tables are at the top, the design grid below, just like in Access. Type the field names in the Field row, pick the sort and click Run. Below the result you see the SQL that Access makes from your grid.
Task Create a query with FirstName, LastName and City of all customers, sorted by last name from A to Z.
Customers 25 rows, 10 columns
| CustomerID | Company | FirstName | LastName | City | PostalCode | Country | CustomerSince | Regular | Discount |
|---|---|---|---|---|---|---|---|---|---|
| 1 | Noah | Evans | Leeds | LS1 1UR | UK | 28 Feb 2023 | ☑ | 0.1 | |
| 2 | Shaw & Partners | Noah | Davies | Glasgow | G1 1XQ | UK | 5 Feb 2024 | ☐ | 0.03 |
| 3 | Northlight Inc | Sophia | Hall | Denver | 80202 | USA | 30 Jun 2024 | ☑ | 0 |
| 4 | Olivia | Evans | Bristol | BS1 4DJ | UK | 29 Jun 2022 | ☑ | 0 | |
| 5 | Olivia | Smith | London | EC1A 1BB | UK | 23 Sep 2025 | ☑ | 0 | |
| 6 | Northlight Inc | Mia | Evans | Manchester | M1 1AE | UK | 1 Feb 2025 | ☐ | 0.1 |
| 7 | Bauer Ltd | Ava | Wilson | UK | 14 Oct 2024 | ☐ | 0.05 | ||
| 8 | Lucas | Taylor | Glasgow | G1 1XQ | UK | 2 Jul 2023 | ☐ | 0 | |
| 9 | Jack | Clark | Seattle | 98101 | USA | 7 Nov 2022 | ☐ | 0.1 | |
| 10 | Northlight Inc | Henry | Taylor | Denver | 80202 | USA | 3 Nov 2022 | ☑ | 0.1 |
| 11 | Northlight Inc | Oliver | Johnson | Bristol | BS1 4DJ | UK | 6 Mar 2024 | ☐ | 0 |
| 12 | Henry | Taylor | Chicago | 60601 | USA | 24 Dec 2023 | ☐ | 0 | |
| 13 | Northlight Inc | Noah | Taylor | London | EC1A 1BB | UK | 12 Oct 2022 | ☐ | 0 |
| 14 | Summit Consulting | Mia | Smith | Austin | 78701 | USA | 6 Feb 2022 | ☑ | 0 |
| 15 | Mia | Clark | Austin | 78701 | USA | 9 Mar 2022 | ☑ | 0.05 | |
| 16 | Chloe | Hall | Seattle | 98101 | USA | 4 May 2022 | ☐ | 0.03 | |
| 17 | Market Street Clinic | Sophia | Johnson | Boston | 02108 | USA | 4 Jun 2023 | ☑ | 0 |
| 18 | Roth Legal | Mia | Wright | Manchester | M1 1AE | UK | 23 Sep 2022 | ☑ | 0.05 |
| 19 | Northlight Inc | Grace | Wright | UK | 16 Dec 2023 | ☐ | 0.03 | ||
| 20 | Northlight Inc | Olivia | Brown | Boston | 02108 | USA | 19 Jun 2023 | ☐ | 0.03 |
| 21 | Liam | Brown | Boston | 02108 | USA | 23 Jun 2025 | ☐ | 0.03 | |
| 22 | Bauer Ltd | James | Johnson | Manchester | M1 1AE | UK | 5 Jun 2025 | ☐ | 0.05 |
| 23 | Noah | Wilson | Austin | 78701 | USA | 23 May 2022 | ☐ | 0 | |
| 24 | Market Street Clinic | James | Smith | Bristol | BS1 4DJ | UK | 16 Jan 2022 | ☐ | 0.1 |
| 25 | Northlight Inc | Sophia | Hall | Denver | 80202 | USA | 4 Aug 2025 | ☑ | 0 |
The design grid
| Row | Meaning |
|---|---|
| Field | which field (or expression) goes into this column |
| Table | which table the field comes from |
| Sort | Ascending, Descending or empty |
| Show | ticked: the field appears in the result |
| Criteria | a condition records must meet (next lesson) |
| or | another condition that applies as an alternative (level 2) |
The order of the grid columns is the order in the result. If several fields have a sort, Access sorts from left to right: by the leftmost field first, and by the next one on ties.
Grid and SQL view
Every query is SQL underneath. The grid of the first exercise becomes:
SELECT Customers.FirstName, Customers.LastName, Customers.City
FROM Customers
ORDER BY Customers.LastName;
You do not have to write SQL yet. Reading along helps, though: SELECT names the fields, FROM the table, ORDER BY the sort. In level 4 you write queries directly in SQL view.
One more exercise: a price list
Task Create a price list: ProductName and UnitPrice from the Products table, most expensive product at the top.
Products 18 rows, 6 columns
| ProductID | ProductName | CategoryID | UnitPrice | UnitsInStock | Discontinued |
|---|---|---|---|---|---|
| 1 | Blue ballpoint pen | 1 | 1.20 | 121 | ☐ |
| 2 | Highlighter 4-pack | 1 | 3.90 | 76 | ☐ |
| 3 | Hole punch | 1 | 8.50 | 237 | ☐ |
| 4 | Stapler | 1 | 12.90 | 61 | ☐ |
| 5 | Lever arch file | 1 | 2.80 | 76 | ☑ |
| 6 | USB drive 64 GB | 2 | 9.90 | 193 | ☐ |
| 7 | Wireless mouse | 2 | 19.90 | 157 | ☐ |
| 8 | Keyboard | 2 | 34.90 | 216 | ☐ |
| 9 | 27-inch monitor | 2 | 229.00 | 129 | ☐ |
| 10 | Headset | 2 | 49.00 | 47 | ☐ |
| 11 | Office chair | 3 | 189.00 | 135 | ☐ |
| 12 | Desk | 3 | 349.00 | 46 | ☐ |
| 13 | Mobile pedestal | 3 | 129.00 | 105 | ☐ |
| 14 | Copy paper A4 | 4 | 4.50 | 35 | ☐ |
| 15 | Notepad | 4 | 1.90 | 122 | ☐ |
| 16 | Envelopes 100-pack | 4 | 6.90 | 93 | ☐ |
| 17 | Labels | 4 | 7.50 | 75 | ☐ |
| 18 | Laminating pouches | 4 | 11.90 | 211 | ☐ |
Categories 4 rows, 2 columns
| CategoryID | Category |
|---|---|
| 1 | Office |
| 2 | Tech |
| 3 | Furniture |
| 4 | Paper |
In real Access: a query in Design view
- Create, Query Design. The Add Tables list appears on the right (a dialog in older versions).
- Double-click the table. It appears at the top as a field list.
- Double-click fields to add them to the grid, or drag them in. The asterisk * adds all fields at once.
- In the Sort row choose Ascending or Descending.
- Run (exclamation mark) on the Query Design tab shows the result as a datasheet. View takes you back to Design view or to SQL view.
- Save with Ctrl+S, for example as “Customer list”. The query then appears in the Navigation Pane.
Other ways
The Query Wizard (Create, Query Wizard, Simple Query Wizard) asks for table and fields step by step and creates the same query. You add sort and criteria in Design view afterwards. If you know SQL, write the query straight into SQL view.
Common mistakes
Misspelled field name
Type “LastNme” instead of “LastName” and Access does not know the field, so it asks for a parameter value when you run the query. That prompt is almost always a typo. Double-clicking in the field list is safer.
Sort on the wrong field
If the sort sits under City instead of LastName, the result is complete but in the wrong order. Check the Sort row in every column.
FAQ
Does a query change my data?
A select query like this one does not. But if you change a value in its result datasheet, the change goes into the table. Action queries that change data on purpose come in level 4.
How many fields can a query have?
According to Microsoft, up to 255 fields in the result. For clear lists, take only the ones you really need.