Please note: the following tutorial will open in a new window/tab. When you have finished the tutorial, simply close the window/tab and you'll return to this page.
Before you go on, please work through the following tutorial:
Creating a simple query
A query allows us to analyse data contained in our table. With a query we can:
- Retrieve only the particular records that we want
- Filter out (or hide) data that does NOT meet a criteria (value)
A query is based on the fields in a table and can contain all of the fields in the table or some of the fields. When designing a query, you would look at the brief to decide what you need to show.
A query can be saved and re-used.
For example, from this table we could create a query that:
- Produces a list of students in alphabetical order
- Sorts students by address
- Shows only students who have scored higher than 75% in their subjects
- Shows students who are missing exam marks.
Using our bookshop database, we’re going to step you through the process of creating a simple query that will show us all books that are hardcovers.
- Open your bookshop database
- In Office 2007 choose Create Tab ⇒ Other Group ⇒ Query Wizard
- In Office 2010 choose Create Tab ⇒ Queries Group ⇒ Query Wizard
- From the dialogue box, choose Simple Query Wizard
- The Tables/Queries dropdown menu shows us tables we can use to make our query with. In this case we have only one – Books.
- The Available Fields menu shows us the fields in the selected table that we can use. We use the > button to promote fields into the Selected Fields box. These selected fields are what will actually be used to make our query.
- Use the > button to promote the following fields from your table into the selected fields menu:
- Year published
- Paperback book
- Click Next. From the next box that pops up, choose Detail then click Next.
- Give your query the name QRY_Paperbacks. Click on Finish.
You should end up with a screen that looks like the following picture:
Don’t forget to save your database.