Databases and SQL – IGCSE Computer Science (0478)

58 questions · page 1 of 4 · Clear filters

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/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.
…
…
…
…

7
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]

8
0478/22/M/J/25 · Question 9May/June 2025Paper 226 marks
Loading question…
Question text

9
A database table, CapitalCity, stores data about capital cities from around the world.
Field
Description
Identification
a unique identifier
Name
the name of the city
Country
the name of the country in which the city is located
Continent
the name of the continent in which the city is located
Population
the number of people living in the city
Founded
the year the city was founded
AverageIncome
average income of the city’s population, in $, rounded to 2 decimal places
Subway
whether or not the city has an underground railway system
(a) Complete the table by writing one appropriate field from CapitalCity for each data type.
Each field must be different.
Data type
Field
Boolean
integer
real
text
[2]
(b) Complete the structured query language (SQL) statement to list only the name, country and
population of all the cities in CapitalCity from the continent of Asia.
SELECT …
… CapitalCity
WHERE … = … ;
[4]
ĬÑĊ®Ġ´íÈõÏĪÅĊÝù·Ā×

Advertisement
9
0478/23/M/J/25 · Question 1May/June 2025Paper 2310 marks
Loading question…
Question text

1
The flowchart shows an algorithm used for quality control on a biscuit production line.
The weight of each biscuit is entered into the variable Weight. If the weight of the biscuit is
between 16.2 and 17.2 grammes, inclusive, the pass counter is incremented by 1. Otherwise,
the reject counter is incremented by 1. The process continues until –1 is entered, after which, the
totals for pass and reject counters are output.
(a) Complete this flowchart.
START
PassCount
0
RejectCount
0
Yes
No
No
Yes
STOP
[6]
ĬÍĊ®Ġ´íÈõÏĪÅĊÝü·þ×
,
,
(b) Explain how you would alter the flowchart in 1(a) so that it calculates and outputs the average
weight of only the biscuits that passed the weight check.
You may include program statements or flowchart symbols in your answer, but they must be
fully explained.
…
…
…
…
…
…
…
…
…
… [4]

10
0478/23/M/J/25 · Question 5May/June 2025Paper 238 marks
Loading question…
Question text

5
(a) A computer store uses a database table COMPONENT to store the stock details of a range of
components needed to build computer systems.
Complete the table by giving appropriate data types for each field.
Only the data types: text, character, Boolean, integer, real, date/time are available in this
database.
Field
Data type
Description
ID
unique identifier
Name
component name
Description
component description
selling price of component to
Price
2 decimal places
NumberAvailable
number in stock
level at which the component
MinimumLevel
is reordered
whether or not the component
ReOrdered
has been reordered
the date the component was
DateOrdered
reordered
[4]
(b) Complete the structured query language (SQL) statement to list only the unique identifier,
component name and reorder date of all the components that have been reordered.
SELECT …
FROM …
WHERE … ;
[4]
ĬÓĊ®Ġ´íÈõÏĪÅĊÞü¶þ×

11
0478/21/M/J/24 · Question 6May/June 2024Paper 2138 marks
Loading question…
Question text

6
The flowchart represents an algorithm.
START
Result
Limit DIV 2 + 1
INPUT
Limit
OUTPUT
Numbers[Result]
Count
1
INPUT
Numbers[Count]
STOP
Count
Count + 1
No
IS Count >
Limit?
No
IS Numbers[Count] >
Yes
Numbers[Count + 1]?
Flag
TRUE
Yes
Swap
Numbers[Count]
IS Flag =
No
TRUE?
Numbers[Count]
Numbers[Count + 1]
Yes
Flag
False
Numbers[Count + 1]
Swap
Count
1
Flag
True
IS Count >
Yes
No
Limit – 1?
Count
Count + 1
(a) Complete the trace table for the input data:
7, 47, 50, 52, 60, 80, 63, 70
Numbers
Limit
Count
[1]
[2]
[3]
[4]
[5]
[6]
[7]
Flag
Swap
Result
OUTPUT
[7]
(b) Outline the processes involved in the algorithm shown in the flowchart on page 6.
…
…
…
…
…
… [3]

12
0478/21/M/J/24 · Question 9May/June 2024Paper 216 marks
Loading question…
Question text

A database table called SoftDrinks stores details of the soft drinks sold by a small shop.
9
Field
Example data
Name
Cola
Supplier
Cambridge Beverages
Container
Can
SizeCl
330
NumberInStock
30
ReorderLevel
15
Reordered
Yes
(a) State whether any of the given fields would be suitable as a primary key and give a reason for
your answer.
…
… [1]
(b) Complete the structured query language (SQL) statement to return the number of cans the
shop has in stock.
SELECT … ( … )
FROM …
WHERE … = … ;
[5]

13
0478/22/M/J/24 · Question 10May/June 2024Paper 228 marks
Loading question…
Question text

10 A television subscription service has a new database table named Contract to store details of
their subscribers’ contracts. The table contains these fields:
•
ContractNumber – the contract number, for example CT567
•
Months – the length of the contract in months, for example 6
•
EndDate – the date the contract finishes, for example 30 November 2024
•
News – the news service, yes or no
•
Movie – the movie service, yes or no
•
Sport – the sports service, yes or no
•
Junior – the children’s service, yes or no.
(a) Identify the field that will be the most appropriate primary key for this table.
… [1]
(b) Complete the table to identify the most appropriate data type for these fields in Contract
Field
Data type
ContractNumber
Months
EndDate
Sport
[2]
(c) Explain the purpose of these structured query language (SQL) statements.
Statement 1: SELECT SUM (Months) FROM Contract;
Statement 2: SELECT COUNT (News) FROM Contract WHERE News;
Statement 1 …
…
…
Statement 2 …
…
…
[3]
,
,
(d) Complete this SQL statement to find the contract numbers of the subscribers that take both
the news and sports services.
SELECT …
FROM Contract
WHERE … AND … ;
[2]

Advertisement
14
0478/23/M/J/24 · Question 5May/June 2024Paper 2313 marks
Loading question…
Question text

5
The flowchart represents an algorithm.
START
L
0
S
10000
T
0
A
0
INPUT
Limit
Count
1
INPUT
Value
IS
IS
No
No
Value < S
Value > L
?
?
Yes
Yes
L
Value
S
Value
T
T + Value
IS
No
Count >
Count
Count + 1
Limit ?
Yes
T / Limit
A
OUTPUT "L = ", L, " S = ",
S, " T = ", T, " A = ", A
STOP
(a) Complete the trace table for the input data:
10, 30, 18, 8, 25, 12, 17, 2, 50, 15, 5
L
S
T
A
Limit
Count
Value
OUTPUT
[6]
(b) Outline the purpose of the algorithm.
…
…
…
… [2]
(c) Explain why the identifiers L, S, T and A may not be appropriate to use as identifiers and how
they could be improved.
…
…
…
…
…
… [3]
(d) State a more appropriate identifier for each of the variables L, S, T and A
Original identifier
Improved identifier
L
S
T
A
[2]

15
0478/23/M/J/24 · Question 8May/June 2024Paper 2310 marks
Loading question…
Question text

A database table called Hangar1 stores details of a collection of historic aircraft at a museum.
8
ID
Make
Model
Year
Engines
Airworthy
JM1
Hawker Siddeley
Nimrod
1966
4
Y
JM2
Douglas
DC-10
1970
3
Y
JM3
Aérospatiale-BAC
Concorde
1973
4
N
PB1
De Havilland
DH-9
1918
1
Y
PB2
Hawker
Fury
1935
1
Y
PB3
Hawker
Nimrod
1934
1
Y
PM1
Fieseler
Storch
1942
1
N
PM2
Hawker
Hurricane
1942
1
Y
PM3
Supermarine
Spitfire
1942
1
N
PM4
Douglas
C-47 Dakota
1942
2
N
PS1
Boeing
314 Clipper
1936
4
N
(a) State the number of fields and records in the database table.
Fields …
Records …
[2]
(b) Give the output that would be produced by the structured query language (SQL) statement:
SELECT Model, Year, Engines
FROM Hangar1
WHERE Engines > 1
ORDER BY Year;
…
…
…
…
…
…
…
… [4]
(c) Complete the SQL statement to display only the ID and model of all the aircraft that are
airworthy.
SELECT ID, …
…
…
… ;
[4]

Advertisement