Databases and SQL – IGCSE Computer Science (0478)

121 questions · page 1 of 9

0 / 0Answer a question to start your score.
Quick quiz (10)Saved 0
Advertisement
1
0478/21/M/J/26 · Question 6May/June 2026Paper 214 marks
Loading question…
Question text

6
Give programming examples for a count‑controlled loop and a post‑condition loop.
Describe each of the loops.
count‑controlled loop example …
description …
…
…
post‑condition loop example …
description …
…
…
[4]
© Cambridge University Press & Assessment 2026

2
0478/21/M/J/26 · Question 9May/June 2026Paper 217 marks
Loading question…
Question text

9
A swimming club wants to set up a new database table to store details of the members of the
club and the maximum distance each member swam in metres.
The table is called SWIMMERS and will contain these fields:
•
Distance – distance the member swam, for example 1500
•
Date – date the member swam the distance
•
Time – time taken to swim the distance
•
MemberID – the code to identify a member, for example TH749
•
MemberName – name of the member.
(a) (i)
State why MemberName would not be appropriate for a primary key.
…
… [1]
(ii)
Give the name of the most appropriate field for the primary key.
…
… [1]
(b) Complete the table to identify the most appropriate data type for these fields in the
table SWIMMERS. Each data type must be different.
field
data type
Distance
Date
MemberID
[2]
(c) Complete the structured query language (SQL) statement to display only the names of the
members who swam a distance of 1500 metres or more.
SELECT …
FROM …
WHERE …
… ;
[3]
© Cambridge University Press & Assessment 2026
,
,
© Cambridge University Press & Assessment 2026

3
0478/22/M/J/26 · Question 9May/June 2026Paper 2210 marks
Loading question…
Question text

9
(a) A database table CAR_PARTS stores details of car parts that a business has in stock.
Complete the table by giving the most appropriate data types for each field.
Only the data types: text, character, Boolean, integer, real and date/time are available in
this database.
field
data type
description
unique code to identify the car
PartID
part with letters and numbers
name of the car part, for example
PartName
windscreen wiper
four-digit number code to
CarType
represent the type of car
Price
selling price to 2 decimal places
specifies the size if relevant,
Size
otherwise stores ‘one size’
single letter code for the colour of
Colour
the car part
NumberInStock
the quantity of car parts in stock
whether or not the car part is
InStock
in stock
[4]
(b) Complete the structured query language (SQL) statement to list only the part ID, type of car
and the quantity in stock of all the car parts that are brake pads.
SELECT …
FROM …
WHERE … ;
[4]
(c) Describe one reason why the InStock field is not needed in the table.
…
…
…
… [2]
© Cambridge University Press & Assessment 2026
ĬÑĊ®Ġ´íÈõÏĪÅĊÝü·Ā×
,
,
© Cambridge University Press & Assessment 2026
ĬÓĊ®Ġ´íÈõÏĪÅĊÝú·Ā×

Advertisement
4
0478/23/M/J/26 · Question 5May/June 2026Paper 237 marks
Loading question…
Question text

5
This flowchart represents an algorithm.
START
PassCount
0
FailCount
0
Count
0
INPUT Size
No
Yes
IS Size <
50.0 ?
PassCount
PassCount + 1
FailCount
FailCount + 1
Count
Count +
1
No
IS Count = 9
?
Yes
OUTPUT "Number
passed: ", PassCount
OUTPUT "Number
failed: ", FailCount
STOP
© Cambridge University Press & Assessment 2026
,
,
(a) Complete the trace table for the algorithm, using the input data:
49.8, 48.7, 62.5, 49.9, 30.0, 58.2, –12.5, 50.0, 26.7, – 49.2, 58.9
PassCount
FailCount
Count
Size
OUTPUT
[5]
(b) Describe how you would change the flowchart to prevent negative numbers from being input.
…
…
…
… [2]
© Cambridge University Press & Assessment 2026

5
0478/23/M/J/26 · Question 8May/June 2026Paper 2311 marks
Loading question…
Question text

8
A database table OPTION_SUBJECTS stores some data about a number of subjects taken by
students in a college.
field
description
SubjectCode
a code such as CSIG01 to represent the subject and level
SubjectName
the name of the subject, for example computer science
Level
the level of the course, for example IGCSE or A Level
CourseWork
whether or not coursework is included as part of the assessment
PracticalExams
the number of practical exams taken during the course
TheoryExams
the number of theory exams taken during the course
length of the course, for example 1 or 2, representing number
CourseLength
of years
the minimum number of students required for the course to run,
MinimumClassSize
for example 10
the maximum number of students admitted to each class, for
MaximumClassSize
example 30
(a) Identify the most appropriate field in OPTION_SUBJECTS for a primary key.
Give one reason for your choice.
primary key field …
reason …
…
[2]
(b) Identify one appropriate field from OPTION_SUBJECTS for each of the given data types.
State one reason for your choice in each case.
integer data type …
reason …
…
Boolean data type …
reason …
…
[4]
© Cambridge University Press & Assessment 2026
,
,
(c) Complete the structured query language (SQL) statement to list only the subject code,
subject name and level for the minimum class size of less than 10. The results should be
listed in order of subject code, from the lowest to the highest.
SELECT …
FROM …
WHERE …
… ;
[5]

6
0478/22/F/M/26 · Question 8Feb/March 2026Paper 2211 marks
Loading question…
Question text

8
A database table NATIONAL_TREES stores details of the national trees of some countries from
around the world.
IDCode
Country
Continent
CommonName
ScientificName
EU121
Albania
Europe
Olive
Olea europaea
OC235
Australia
Oceania
Golden wattle
Acacia pycnantha
NO126
The Bahamas
North America
Lignum vitae
Guaiacum sanctum
AS534
Bangladesh
Asia
Mango tree
Mangifera indica
SO326
Brazil
South America
Brazilwood
Caesalpinia echinata
NO124
Canada
North America
Maple
Acer
EU321
Cyprus
Europe
Golden oak
Quercus alnifolia
NA456
Dominican Republic
North America
West Indian mahogany
Swietenia mahagoni
EU652
Finland
Europe
Silver birch
Betula pendula
AS222
India
Asia
Indian banyan
Ficus benghalensis
NO232
Jamaica
North America
Blue mahoe
Talipariti elatum
AF875
Madagascar
Africa
Baobab
Adansonia
OC123
New Zealand
Oceania
Silver fern
Cyathea dealbata
AS498
Philippines
Asia
Narra
Pterocarpus indicus
AF501
South Africa
Africa
Real yellowwood
Podocarpus Iatifolius
SO522
Venezuela
South America
Araguaney
Tabebuia chrysantha
(a) State the number of fields and records in this database table.
fields …
records …
[2]
(b) The data in both IDCode and Country fields are unique in the database table.
State one reason why IDCode would make a better primary key than Country
…
… [1]
© Cambridge University Press & Assessment 2026
,
,
(c) Give the output that would be produced by the structured query language (SQL) statement:
SELECT IDCode, Country, CommonName
FROM NATIONAL_TREES
WHERE Continent = "Europe";
…
…
…
…
…
… [3]
(d) Complete the SQL statement to list only the country, common name and scientific name of
the national trees listed for North America, in alphabetical order of their common names.
SELECT …
FROM …
WHERE …
… ;
[5]
© Cambridge University Press & Assessment 2026

7
0478/21/O/N/25 · Question 1Oct/Nov 2025Paper 214 marks
Loading question…
Question text

1
Four descriptions of structured query language (SQL) keywords and five SQL keywords are
given.
Draw one line from each description to its matching keyword.
Not all SQL keywords will be used.
Description
SQL keywords
ORDER BY
identifies the database table
COUNT
sets the condition
WHERE
sorts the results
SUM
returns the number of records
FROM
[4]

8
0478/21/O/N/25 · Question 7Oct/Nov 2025Paper 2110 marks
Loading question…
Question text

7
The flowchart represents an algorithm.
START
Count
0
INPUT Number
Value
Count * Number
IS Value <=
Count
Count + 1
Yes
100 ?
No
Count
Count - 1
OUTPUT Count
STOP
ĬÙĊ®Ġ´íÈõÏĪÅĊàüµĀ×
,
,
(a) Complete the tables, using the flowchart, for the given data:
Input data: 20
Count
Number
Value
Output
Input data: 110
Count
Number
Value
Output
[4]
ĬÛĊ®Ġ´íÈõÏĪÅĊàúµĀ×
,
,
(b) State the purpose of the algorithm on page 8. A copy of the algorithm is provided for you on
page 11.
…
… [1]
(c) State a suitable data type for the variable Count
… [1]
(d) Write the algorithm in pseudocode. A copy of the algorithm is provided for you on page 11.
…
…
…
…
…
…
…
…
… [4]
ĬÙĊ®Ġ´íÈõÏĪÅĊÝü·þ×
,
,
START
Count
0
INPUT Number
Value
Count * Number
IS Value <=
Count
Count + 1
Yes
100 ?
No
Count
Count - 1
OUTPUT Count
STOP
ĬÛĊ®Ġ´íÈõÏĪÅĊÝú·þ×

Advertisement
9
0478/21/O/N/25 · Question 8Oct/Nov 2025Paper 216 marks
Loading question…
Question text

8
A school has set up a database table SchoolTrip to record details of students that will go on a
school trip.
StudentID
StudentName
ParentName
Permission
DateReceived
STU147
Amir
Mr Akar
True
03/03/2025
STU348
Filip
Mrs Johnson
True
04/03/2025
STU274
Matthew
Mr Smith
False
STU873
Jafar
Mr Al-Saigh
True
21/03/2025
STU221
Hussein
Mr Alkasab
True
28/02/2025
STU553
Julie
Mrs Jones
True
25/02/2025
STU213
Julie
Mr Smith
False
(a) State the reason why ParentName is not appropriate as the primary key.
… [1]
(b) Give the name of the field that should be the primary key.
… [1]
(c) The database only uses these data types:
•
text
•
character
•
Boolean
•
integer
•
real
•
date/time.
Complete the table to show the most appropriate data type for each field.
Each data type must be different.
Field
Data type
ParentName
Permission
DateReceived
[2]
(d) Complete the structured query language (SQL) statement to display only the names of the
students who do not have permission to go on the trip.
SELECT …
FROM …
WHERE …
[2]
ĬÙĊ®Ġ´íÈõÏĪÅĊßü·Ā×

10
0478/22/O/N/25 · Question 7Oct/Nov 2025Paper 2210 marks
Loading question…
Question text

7
A database table WATERFOWL stores some details of a range of birds found in the UK that live on
or near water. The length and wingspan dimensions are in centimetres and the typical lifespan is
in years.
Species
Family
Length
Wingspan
CoastalHabitat
Lifespan
Barnacle goose
Goose
63.5
130.0
FALSE
14
Bewick’s swan
Swan
120.2
190.5
TRUE
8
Brent goose
Goose
58.0
94.3
TRUE
11
Canada goose
Goose
78.5
160.0
FALSE
6
Eider
Duck
58.0
94.5
TRUE
8
Goldeneye
Duck
44.5
72.1
TRUE
6
Goosander
Duck
63.3
90.0
TRUE
7
Long‑tailed duck
Duck
44.0
76.6
TRUE
5
Mallard
Duck
59.7
90.8
FALSE
3
Mute swan
Swan
150.0
220.2
FALSE
10
Pink‑footed goose
Goose
69.6
150.0
TRUE
8
Pintail
Duck
60.0
88.6
TRUE
3
Smew
Duck
41.5
62.1
FALSE
7
White‑fronted goose
Goose
71.5
140.0
FALSE
6
Whooper swan
Swan
150.0
230.0
TRUE
9
(a) State the purpose of a primary key in a database table.
…
… [1]
(b) Complete the table for each of the given data types, to identify one field from the table
WATERFOWL that is most likely to use it.
Each field must be different.
Data type
Field
Boolean
Integer
Real
Text
[2]
ĬÑĊ®Ġ´íÈõÏĪÅĊÞü¸þ×
,
,
(c) Give the output that would be produced by the structured query language (SQL) statement:
SELECT Species, Length, Wingspan
FROM WATERFOWL
WHERE Family = "Swan"
ORDER BY Lifespan;
…
…
…
…
…
… [3]
(d) Complete the SQL statement to list only the species, family and lifespan of all waterfowl
whose typical lifespan is at least 10 years, sorted in order of species.
SELECT …
…
…
… [4]
ĬÓĊ®Ġ´íÈõÏĪÅĊÞú¸þ×

11
0478/23/O/N/25 · Question 5Oct/Nov 2025Paper 236 marks
Loading question…
Question text

5
A program has been written in pseudocode to input five numbers between 1 and 900 inclusive and
store the highest number and the lowest number entered.
900
01
Lowest
1
02
Highest
1 TO 5
03
FOR Count
04
INPUT Number
05
IF Number < Lowest
06
THEN
Number
07
Lowest
08
ELSE
09
IF Number > Highest
10
THEN
Number
11
Highest
12
ENDIF
13
ENDIF
14
NEXT Count
(a) Complete the trace table for the algorithm using the following numbers:
563, 21, 376, 99, 400
Count
Number
Lowest
Highest
[4]
(b) The algorithm does not work correctly.
State the reason why the algorithm does not work as expected and explain how the algorithm
could be corrected.
Any code used must be fully explained.
Reason …
…
Correction …
…
[2]
ĬÏĊ®Ġ´íÈõÏĪÅĊÞü¸Ā×

12
0478/23/O/N/25 · Question 6Oct/Nov 2025Paper 239 marks
Loading question…
Question text

6
The flowchart represents an algorithm.
START
Position
–1
Count
1
INPUT Name
IS Name =
Yes
Position
Count
ClassList[Count]
?
No
Count
Count + 1
No
IS Count
> 5 ?
Yes
OUTPUT
Position
STOP
ĬÑĊ®Ġ´íÈõÏĪÅĊßüµþ×
,
,
(a) The algorithm uses the one-dimensional (1D) array ClassList that contains the following
data:
ClassList
1
2
3
4
5
Henil
Sven
Ella
Asia
Ridwan
Complete the table by writing the output from the flowchart when each of the given names are
input.
Name
OUTPUT
Ridwan
Yan
Ella
[2]
(b) Identify the standard method of solution used by the flowchart.
… [1]
(c) Write the algorithm in pseudocode.
…
…
…
…
…
…
…
…
…
…
…
…
… [6]
ĬÓĊ®Ġ´íÈõÏĪÅĊßúµþ×

13
0478/23/O/N/25 · Question 8Oct/Nov 2025Paper 235 marks
Loading question…
Question text

8
A school has set up a database table EquipmentLoan to record details of school equipment
loaned to students.
EquipmentID
Description
Name
DateLoaned
Returned
Cam01
Digital camera
James
23/04/2025
No
Cam04
Digital camera
Amir
12/03/2025
Yes
Gra02
Graphics tablet
Nikita
27/04/2025
No
Tab01
Tablet
Holly
18/03/2025
Yes
Ext01
External Hard drive
Hussein
27/04/2025
Yes
Cam02
Digital camera
Emily
10/04/2025
Yes
Tri01
Tripod
Emily
10/04/2025
Yes
(a) (i)
Give the name of the field that is most appropriate to be the primary key.
… [1]
(ii)
State the reason for choosing this field for the primary key.
…
… [1]
(b) Complete the structured query language (SQL) statement to list equipment not returned.
The list must contain only the descriptions and student names.
SELECT …
FROM …
WHERE … ;
[3]
ĬÑĊ®Ġ´íÈõÏĪÅĊàü·þ×

Advertisement
14
0478/21/M/J/25 · Question 4May/June 2025Paper 218 marks
Loading question…
Question text

4
A telephone number with 13 characters is input. The first character is a ‘+’, followed by a 2-digit
country code, for example:
+20xxxxxxxxxx where 20 is the country code and x is a digit between 0 and 9 inclusive.
The algorithm includes checks for the country codes: 44 for the UK and 20 for Egypt.
(a) Write an algorithm using pseudocode to:
•
input the telephone number
•
extract the 2-digit country code
•
output the matching country
•
output ‘Unknown’ if there is no matching country.
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
… [5]
ĬÍĊ®Ġ´íÈõÏĪÅĊÝù·Ā×
,
,
(b) Explain how you could change the algorithm to repeatedly prompt for the telephone number
until the number entered is 13 characters in length.
Any code used must be fully explained.
…
…
…
…

15
0478/21/M/J/25 · Question 8May/June 2025Paper 217 marks
Loading question…
Question text

8
A bus company has set up a new database table called BUS to store details of the buses leaving
the main bus terminal.
RouteID
Destination
Stops
Driver
Time
Return
BC01
Town Centre
10
B Smith
9:00
Yes
BC02
The Fountain
5
A Patel
9:10
Yes
BC03
The Palace
9
B Hayes
9:28
No
BC04
City Park
12
W Gao
9:55
Yes
BC05
City Mall
9
R Hussein
10:10
No
BC06
Swan Lake
14
S Clarke
10:33
No
BC07
Guildhall Square
7
J Page
11:34
No
BC08
Sunset Quay
6
A Patel
12:01
Yes
BC10
Fort Worthington
15
E Carr
12:01
Yes
BC12
The Observatory
18
B Smith
13:27
No
BC14
East Seaport
11
B Scott
14:07
No
BC15
The Football Ground
12
J Page
14:46
Yes
BC19
The Cricket Ground
11
B Hayes
15:14
No
BC23
Temple Ruins
14
W Gao
16:16
No
BC27
The University
9
A Patel
16:45
No
(a) (i)
Identify one appropriate data type for the field Return
… [1]
(ii)
State the reason for the data type chosen.
…
… [1]
(b) Write the output from the structured query language (SQL) statement:
SELECT RouteID, Destination, Time
FROM BUS
WHERE Driver = "A Patel";
…
…
…
…
… [2]
ĬÑĊ®Ġ´íÈõÏĪÅĊÞû¶Ā×
,
,
(c) Complete the SQL statement to display only the destination of the buses that have a return.
SELECT …
…
…
… [3]

Advertisement