Practice Questions
O Level Computer Science: Databases — Practice Questions (Cambridge 2210)
Original exam-style questions with full worked answers on fields, records and primary keys, choosing data types for fields, and writing and reading SQL using SELECT, FROM, WHERE, ORDER BY, SUM and COUNT, for Cambridge O Level Computer Science (2210).
- Subject
- Computer Science
- Level
- O LEVELS
- Topic
- Databases
- Author
- Marlbridge Academic Team
- Updated
- Reviewed by
- Harris Khan (what this means)
Aligned to Cambridge O Level Computer Science (2210), 2026-2028. Official specification .
Syllabus page (what it covers and how it is assessed): Cambridge O Level Computer Science.
Syllabus points this page covers
2210
- 9 Databases (whole topic)
Found an error? Report a correction.
Need help with this topic? Request a free trial class for O Level Computer Science (2210).
These are original questions written for Marlbridge, for revision and practice on this content. They are not reproduced past-paper questions, and they do not replicate the exam’s exact structure, question count or mark tariffs — Cambridge International holds copyright in its own papers. Use these alongside the official past papers available from your board.
Each question practises a skill tested in the June 2025 Paper 22. After each answer there is a mark-scheme insight or a tip and, where one matches, the real question to try next.
Questions
1. A vet’s clinic stores data about the animals it treats in a database called Pet. Each record has the fields PetID (a unique code such as P01), PetName, Species, OwnerSurname, WeightKg (the weight in kg, to one decimal place), Vaccinated (whether or not the animal is fully vaccinated) and Visits (the number of visits so far this year). The database holds these records: P01 is Biscuit, a dog owned by Khan, 12.4 kg, vaccinated, 3 visits; P02 is Misty, a cat owned by Ahmed, 4.1 kg, not vaccinated, 1 visit; P03 is Rocky, a dog owned by Silva, 31.0 kg, vaccinated, 2 visits; P04 is Pepper, a cat owned by Okafor, 3.6 kg, vaccinated, 4 visits; P05 is Nibbles, a rabbit owned by Khan, 1.8 kg, not vaccinated, 2 visits; P06 is Bruno, a dog owned by Ahmed, 24.5 kg, not vaccinated, 5 visits.
(a) State how many fields and how many records the Pet database holds.
(b) Identify the most suitable primary key for Pet and explain why OwnerSurname would not be suitable as the primary key. [4]
2. A vet’s database called Pet has the fields PetID (a unique code such as P01), PetName, Species, OwnerSurname, WeightKg (the weight in kg, to one decimal place), Vaccinated (whether or not the animal is fully vaccinated) and Visits (the number of visits so far this year). The Species field holds values such as Dog, Cat and Rabbit. State the most suitable data type for each of these fields: WeightKg, Vaccinated, Species and Visits. [2]
3. A vet’s database called Pet has the fields PetID, PetName, Species, OwnerSurname, WeightKg, Vaccinated and Visits. The Species field holds values such as ‘Dog’, ‘Cat’ and ‘Rabbit’. Write an SQL statement to list only the pet name and the owner’s surname of every dog in Pet. [4]
4. A vet’s database called Pet has the fields PetID, PetName, Species, OwnerSurname, WeightKg (the weight in kg, to one decimal place), Vaccinated and Visits. Write an SQL statement to list the PetID and weight of every animal that weighs more than 20 kg, with the heaviest animal first. [4]
5. A vet’s database called Pet has the fields PetID, PetName, Species, OwnerSurname, WeightKg, Vaccinated and Visits. Species values are stored as ‘Dog’, ‘Cat’ and ‘Rabbit’, and Vaccinated is TRUE or FALSE. It holds six records: P01 is Biscuit, a dog owned by Khan, 12.4 kg, vaccinated, 3 visits; P02 is Misty, a cat owned by Ahmed, 4.1 kg, not vaccinated, 1 visit; P03 is Rocky, a dog owned by Silva, 31.0 kg, vaccinated, 2 visits; P04 is Pepper, a cat owned by Okafor, 3.6 kg, vaccinated, 4 visits; P05 is Nibbles, a rabbit owned by Khan, 1.8 kg, not vaccinated, 2 visits; P06 is Bruno, a dog owned by Ahmed, 24.5 kg, not vaccinated, 5 visits. State the output of each SQL statement.
(a) SELECT COUNT(*) FROM Pet WHERE Vaccinated = TRUE;
(b) SELECT SUM(Visits) FROM Pet WHERE Species = 'Dog';
(c) SELECT PetName FROM Pet WHERE WeightKg < 5 ORDER BY PetName; [3]
Answers
1. (a) 7 fields [1] and 6 records [1]. (b) PetID [1]. OwnerSurname is not unique: for example, Khan owns both Biscuit and Nibbles, so the surname cannot identify one record on its own [1].
Tip: A primary key must hold a different value in every record. Look for repeated values in the data you are given to rule out other fields.
2. WeightKg: real; Vaccinated: Boolean; Species: text; Visits: integer. All four correct [2]; two or three correct [1].
Mark-scheme insight (Cambridge 2210 June 2025 mark scheme, Paper 22, Question 9(a)): The same banding was used: two marks for all four fields correct, one mark for two or three. The identifier field was listed under both integer and text, so either type was accepted; base your choice on what the values in the data look like.
Source for the mark-scheme insights on this page: Cambridge O Level Computer Science 2210 June 2025 mark scheme for Paper 22 (2210/22), paraphrased. This mark scheme is not published on Cambridge’s 2210 past papers page (checked September 2026).
Try the real question next: Cambridge O Level Computer Science 2210, June 2025, Paper 22, Question 9.
3.
SELECT PetName, OwnerSurname
FROM Pet
WHERE Species = 'Dog';
Both correct fields, and only those, after SELECT [1]; FROM Pet [1]; the correct field Species in the WHERE clause [1]; the correct criterion ‘Dog’ in quotation marks [1].
Mark-scheme insight (Cambridge 2210 June 2025 mark scheme, Paper 22, Question 9(b)): Each part of the statement earned its own mark: the fields after SELECT, the keyword FROM, the field in WHERE and the criterion. A text criterion was accepted in either single or double quotation marks.
Try the real question next: Cambridge O Level Computer Science 2210, June 2025, Paper 22, Question 9.
4.
SELECT PetID, WeightKg
FROM Pet
WHERE WeightKg > 20
ORDER BY WeightKg DESC;
PetID and WeightKg after SELECT and FROM Pet [1]; WHERE WeightKg > 20 [1]; ORDER BY WeightKg [1]; DESC so the heaviest comes first [1]. (With the six records given in Question 5, this would list P03, 31.0 and then P06, 24.5.)
Tip: A numeric criterion is written without quotation marks, and ORDER BY sorts in ascending order unless you add DESC.
Try the real question next: Cambridge O Level Computer Science 2210, June 2025, Paper 22, Question 9.
5. (a) 3 (P01, P03 and P04 are vaccinated) [1]. (b) 10 (the dogs have 3 + 2 + 5 visits) [1]. (c) Misty, Nibbles, Pepper: the animals under 5 kg are Misty (4.1), Pepper (3.6) and Nibbles (1.8), listed in alphabetical order of name [1].
Tip: Work through the records one at a time, first picking out those that meet the WHERE condition, and only then apply COUNT, SUM or ORDER BY to that smaller set.
Where marks are usually lost
- Listing extra fields after SELECT (or using SELECT *) when the question asks for only some fields.
- Leaving out FROM and the name of the database, or putting the wrong field in the WHERE clause.
- Forgetting quotation marks around a text criterion, or putting them around a number.
- Choosing text for a field that only ever holds numbers, or integer for a value with decimal places.
- Forgetting DESC when the largest value must come first.
Get free revision emails (optional)
Occasional emails with practice questions, worked explanations and links to free resources for the qualification and subjects you choose. No spam, and you can unsubscribe from any email. The free tools on this site never need an email.
Related resources
-
Practice Questions
A Level Computer Science: Databases — Practice Questions (Cambridge 9618)
Original exam-style practice questions with full worked answers on primary, candidate and foreign keys, referential integrity, normalisation and SQL for Cambridge AS & A Level Computer Science (9618) Topic 8.
Computer Science · Cambridge · AS LEVEL
-
Study Guides
O Level Computer Science: Hardware (Cambridge 2210)
The fetch-decode-execute cycle and CPU components, named input/output devices and sensors, primary/secondary/cloud storage, and network hardware – the full content of Topic 3 for Cambridge O Level Computer Science 2210, 2026-2028 series.
Computer Science · Cambridge · O LEVELS
-
Practice Questions
O Level Computer Science: Hardware — Practice Questions (Cambridge 2210)
Original exam-style practice questions with full worked answers on the fetch-decode-execute cycle, sensors, data storage and network hardware, for Cambridge O Level Computer Science (2210) Topic 3 Hardware.
Computer Science · Cambridge · O LEVELS
Related articles
-
curriculum guides
Choosing subjects at IGCSE and A Level
How subject choices at 14 and 16 affect university options later, and how to keep pathways open without overloading a timetable.
28 July 2026
-
study skills
How to revise for a science examination
Most science revision fails because it rereads notes instead of retrieving them. A practical method for revising physics, chemistry and biology in the weeks before a paper.
14 July 2026
Studying this with a teacher
Working through Computer Science O LEVELS?
This page is free and stays free. If you would rather be taught it, Marlbridge runs Computer Science classes one-to-one and in small groups of up to 15, online in your own time zone. The first trial class is free. WhatsApp replies within an hour (8am–11pm Pakistan time, every day); email the same day.
Cambridge Computer Science teachers at Marlbridge