IGCSE · Computer Science 0478 · Databases & logic

Databases & SQL: IGCSE Computer Science questions with answers

Free Databases & SQL questions for IGCSE Computer Science (0478), part of Databases & logic. Each question has the answer and the marking points an examiner would look for.

Generate a full Databases & SQL worksheet →All Databases & logic questions

Databases & SQL practice questions

Question 1Structured · 7 marks

A shop stores data in a database table called PRODUCTS.

ProductIDNameCategoryPriceStock
P101PuzzleToy15.1834
P102AtlasBook5.7851
P103ChessGame8.5324
P104RobotToy15.6239
P105NovelBook22.6255
P106CardsGame19.7755
P107KiteToy4.3149
Table 1.1
(a)

State the field that is the most suitable primary key.

[1]
(b)

Write an SQL query to display the Name and Price of products in the category Toy with a price greater than 12, in descending order of Price.

[4]
(c)

State the output of: SELECT Name FROM PRODUCTS WHERE Stock < 18;

[2]
Show answers and mark scheme
PartAnswer and marking pointsMarks
(a)ProductID
ProductID B1
1
(b)SELECT Name, Price FROM PRODUCTS WHERE Category = 'Toy' AND Price > 12 ORDER BY Price DESC;
SELECT Name, Price B1
FROM PRODUCTS B1
WHERE Category = 'Toy' AND Price > 12 B1
ORDER BY Price DESC B1
4
(c)no records
All correct names B2
B1 for one error/omission
2
Question 2Structured · 6 marks

A school stores data in several database tables. The table shows some of the fields.

(a)

Identify the most suitable data type for each field.

FieldData type
the height of a plant in metres
a parent’s email address
the price of a meal
whether a member has paid
Table 2.1
[4]
(b)

Explain why a phone number is not stored as an integer.

[2]
Show answers and mark scheme
PartAnswer and marking pointsMarks
(a)the height of a plant in metres: real; a parent’s email address: text / string; the price of a meal: real; whether a member has paid: Boolean
the height of a plant in metres: real B1
a parent’s email address: text / string B1
the price of a meal: real B1
whether a member has paid: Boolean B1
4
(b)It may start with 0 / contain spaces or + signs, which would be lost; no calculations are done on it
Leading zeros / spaces / symbols would be lost B1
It is never used in calculations B1
2
Question 3Structured · 6 marks

A sports centre stores data about its trainers in a table called TRAINERS.

TrainerIDNameSiteHoursYearJoined
T201AshaEast122022
T202BenNorth82024
T203ChenNorth52022
T204DinaNorth32024
T205EliSouth42020
T206FarahNorth92016
T207GitaSouth62020
Table 3.1
(a)

State the number of records and the number of fields in the table.

[2]
(b)

State the output of: SELECT COUNT(*) FROM TRAINERS WHERE Site = 'East';

[1]
(c)

Write an SQL query to output the total Hours worked by trainers who joined after 2020.

[3]
Show answers and mark scheme
PartAnswer and marking pointsMarks
(a)7 records, 5 fields
7 records B1
5 fields B1
2
(b)1
1 B1
1
(c)SELECT SUM(Hours) FROM TRAINERS WHERE YearJoined > 2020; (gives 28)
SELECT SUM(Hours) B1
FROM TRAINERS B1
WHERE YearJoined > 2020 (accept >= 2021) B1
3
Question 4Structured · 2 marks
(a)

State what is meant by the term primary key.

[1]
(b)

State what is meant by the term record.

[1]
Show answers and mark scheme
PartAnswer and marking pointsMarks
(a)A field that uniquely identifies each record
A field that uniquely identifies each record B1
1
(b)A collection of related fields about one item
A collection of related fields about one item B1
1
Question 5Structured · 7 marks

A shop stores data in a database table called PRODUCTS.

ProductIDNameCategoryPriceStock
P101PuzzleToy8.059
P102AtlasBook10.0751
P103ChessGame30.9540
P104RobotToy18.2134
P105NovelBook23.1657
P106CardsGame29.3517
P107KiteToy9.5534
Table 5.1
(a)

State the field that is the most suitable primary key.

[1]
(b)

Write an SQL query to display the Name and Price of products in the category Game with a price greater than 27, in descending order of Price.

[4]
(c)

State the output of: SELECT Name FROM PRODUCTS WHERE Stock < 20;

[2]
Show answers and mark scheme
PartAnswer and marking pointsMarks
(a)ProductID
ProductID B1
1
(b)SELECT Name, Price FROM PRODUCTS WHERE Category = 'Game' AND Price > 27 ORDER BY Price DESC;
SELECT Name, Price B1
FROM PRODUCTS B1
WHERE Category = 'Game' AND Price > 27 B1
ORDER BY Price DESC B1
4
(c)Puzzle, Cards
All correct names B2
B1 for one error/omission
2
Question 6Structured · 6 marks

A sports centre stores data about its trainers in a table called TRAINERS.

TrainerIDNameSiteHoursYearJoined
T201AshaNorth32017
T202BenEast112023
T203ChenEast62021
T204DinaSouth62023
T205EliSouth72019
T206FarahEast92019
T207GitaSouth52017
Table 6.1
(a)

State the number of records and the number of fields in the table.

[2]
(b)

State the output of: SELECT COUNT(*) FROM TRAINERS WHERE Site = 'South';

[1]
(c)

Write an SQL query to output the total Hours worked by trainers who joined after 2020.

[3]
Show answers and mark scheme
PartAnswer and marking pointsMarks
(a)7 records, 5 fields
7 records B1
5 fields B1
2
(b)3
3 B1
1
(c)SELECT SUM(Hours) FROM TRAINERS WHERE YearJoined > 2020; (gives 23)
SELECT SUM(Hours) B1
FROM TRAINERS B1
WHERE YearJoined > 2020 (accept >= 2021) B1
3

More Databases & logic questions

Want a mentor, not just a paper?

Riyaz Shaikh has mentored IGCSE, IB and A Level students for 15+ years, one-on-one, online and in Mumbai. The hardest questions on this site are the ones he uses to find a student's weak points.

Meet Riyaz →

Original Cambridge-style practice questions written for mentorriyaz.in. These are not Cambridge past paper questions, and this site is not affiliated with or endorsed by Cambridge University Press & Assessment. Updated 2026-11-04. Paper generator · mentorriyaz.in