Databases: tables, records and queries
Schools, shops and games all keep huge amounts of data in databases. A database stores data in tables so it can be searched in a fraction of a second.
Tables, records and fields
Each row is a record: all the data about one thing (one pet).
Each column is a field: one piece of data about every record, such as Age.
A primary key is a field that is different for every record, so each record can be identified. Here it is PetID.
| PetID | Name | Animal | Age |
|---|---|---|---|
| 1 | Biscuit | dog | 4 |
| 2 | Luna | cat | 2 |
| 3 | Nibbles | rabbit | 1 |
| 4 | Shadow | cat | 7 |
| 5 | Pepper | dog | 9 |
Queries
SELECT Name FROM Pets WHERE Animal = 'cat'
returns: Luna, Shadow.
SELECT says which fields to show, FROM says which table, WHERE gives the condition.
| PetID | Name | Animal | Age |
|---|---|---|---|
| 1 | Biscuit | dog | 4 |
| 2 | Luna | cat | 2 |
| 3 | Nibbles | rabbit | 1 |
| 4 | Shadow | cat | 7 |
| 5 | Pepper | dog | 9 |
Why use a database?
Queries find and sort data quickly, even with millions of records.
Each field has a data type (such as text or integer), which helps stop mistakes like typing a word into Age.
Spreadsheets are good for calculations and charts; databases are better for large amounts of linked data.
Using the Pets table, what does this query return?
SELECT Name, Age FROM Pets WHERE Age >= 2 ORDER BY Age
- WHERE Age >= 2 keeps every pet aged 2 or more: Biscuit, Luna, Shadow, Pepper (Nibbles is 1).
- ORDER BY Age sorts from youngest to oldest.
Answer: Luna (2), Biscuit (4), Shadow (7), Pepper (9)
A database stores data in tables. A record is one row about one thing, a field is one column, and a primary key is unique for every record. Queries such as SELECT ... FROM ... WHERE ... find matching records.
- AND
- A Boolean operator that gives True (1) only when both inputs are True.
- Condition
- An expression that is either True or False, such as score > 50, used in if statements and while loops.
- Data type
- The kind of data a value is, such as integer, real (float), string or Boolean.
- Integer
- A whole number data type, such as 7 or −3.
Try two quick questions
See if it has sunk in. Answers are marked straight away.
2 more questions
Try each one, then tap to check.
In a database table, what is a field?
- One row of data
- The whole table
- A chart
- One column, holding one type of data
Show the answer
Answer: One column, holding one type of data
A field is a column.
In the Pets table, the row 4, Shadow, cat, 7 is a...
- field
- primary key
- query
- record
Show the answer
Answer: record
One row is one record.
Check you have got it
Answer 6 quick questions with instant marking. If you get one wrong, GCSE-ready shows you why and gives you another go. It is free, and you do not need an account.
Last updated 2 October 2026. Spotted a mistake? Tell us and we will fix it.