Working with databases/Database queries/Simple queries
From WikiEducator
Working with databases | |
---|---|
Database queries | Introduction | Simple queries | Modifying queries | Advanced queries | Key points | Assessment |
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.