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.

Practise this lesson free (6 questions)

Tables, records and fields

A database is an organised store of data. Data is kept in tables.
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.
The Pets table
PetIDNameAnimalAge
1Biscuitdog4
2Lunacat2
3Nibblesrabbit1
4Shadowcat7
5Pepperdog9

Queries

A query searches the database for records that match a condition. Many databases use a language called SQL.
SELECT Name FROM Pets WHERE Animal = 'cat'
returns: Luna, Shadow.
SELECT says which fields to show, FROM says which table, WHERE gives the condition.
The Pets table
PetIDNameAnimalAge
1Biscuitdog4
2Lunacat2
3Nibblesrabbit1
4Shadowcat7
5Pepperdog9

Why use a database?

Data is stored once, in one place, so it is easier to keep accurate.
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.
Worked example

Using the Pets table, what does this query return?
SELECT Name, Age FROM Pets WHERE Age >= 2 ORDER BY Age

  1. WHERE Age >= 2 keeps every pet aged 2 or more: Biscuit, Luna, Shadow, Pepper (Nibbles is 1).
  2. ORDER BY Age sorts from youngest to oldest.

Answer: Luna (2), Biscuit (4), Shadow (7), Pepper (9)

Key idea

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.

Key words
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.

All KS3 Computing key terms and definitions →

Quick check

Try two quick questions

See if it has sunk in. Answers are marked straight away.

Extra practice

2 more questions

Try each one, then tap to check.

  1. In a database table, what is a field?

    1. One row of data
    2. The whole table
    3. A chart
    4. One column, holding one type of data
    Show the answer

    Answer: One column, holding one type of data

    A field is a column.

  2. In the Pets table, the row 4, Shadow, cat, 7 is a...

    1. field
    2. primary key
    3. query
    4. 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.

Video for this lesson coming soon. Subscribe on YouTube

Sources and references

Last updated 2 October 2026. Spotted a mistake? Tell us and we will fix it.