Databases and SQL – IGCSE Computer Science (0478)

47 questions · page 1 of 4 · Clear filters

0 / 0Answer a question to start your score.
Quick quiz (10)Saved 0
Advertisement
1
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]

2
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
ĬÛĊ®Ġ´íÈõÏĪÅĊÝú·þ×

3
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]
ĬÙĊ®Ġ´íÈõÏĪÅĊßü·Ā×

Advertisement
4
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]
ĬÓĊ®Ġ´íÈõÏĪÅĊÞú¸þ×

5
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]
ĬÏĊ®Ġ´íÈõÏĪÅĊÞü¸Ā×

6
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]
ĬÓĊ®Ġ´íÈõÏĪÅĊßúµþ×

7
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]
ĬÑĊ®Ġ´íÈõÏĪÅĊàü·þ×

8
0478/21/O/N/24 · Question 10Oct/Nov 2024Paper 2110 marks
Loading question…
Question text

10 A shop that sells cheese has set up a new database table called CheeseStock to store details of
the cheeses available for sale. Part of this table is given.
ChNo
Name
InStock
SupplierCode
PricePerKg
WeightKg
CH01
American
Yes
XYZ
4.50
20.0
CH02
Brie
Yes
XYZ
7.50
21.0
CH03
Burrata
No
IMP
13.75
0.0
CH04
Camembert
No
ABC
16.85
0.0
CH05
Cheddar
Yes
ABC
5.00
50.0
CH06
Comté
No
SPC
7.35
0.0
CH07
Cottage
Yes
XYZ
4.50
3.0
CH08
Cream
Yes
XYZ
5.50
6.5
CH12
Emmental
Yes
IMP
2.75
1.5
CH15
Feta
Yes
IMP
12.75
12.0
CH16
Fontina
Yes
SPC
15.99
1.2
CH17
Gorgonzola
Yes
SPC
15.25
0.3
CH19
Gouda
Yes
SPC
7.99
2.5
CH21
Gruyère
No
SPC
16.75
0.0
CH22
Halloumi
Yes
IMP
4.75
15.0
CH23
Havarti
No
SPC
6.75
0.0
CH27
Manchego
No
IMP
13.99
0.0
CH30
Manouri
No
IMP
18.50
0.0
CH31
Mascarpone
No
SPC
12.99
0.0
(a) State the number of records in this part of the database table.
… [1]
(b) (i)
Give the name of the field that would be used for the primary key.
… [1]
(ii)
State the reason for choosing this field for the primary key.
…
… [1]
ĬÑĊ®Ġ´íÈõÏĪÅĊßü·þ×
,
,
(c) Write the output from this structured query language (SQL) statement.
SELECT ChNo, WeightKg
FROM CheeseStock
WHERE SupplierCode = 'ABC';
…
…
… [2]
(d) (i)
Complete this SQL statement to display only the name of all the cheeses that are out of
stock.
SELECT …
FROM …
WHERE … ;
[3]
(ii)
Explain how one of the lines in your statement in part (d)(i) could be changed to display
the same information.
…
…
…
… [2]
ĬÓĊ®Ġ´íÈõÏĪÅĊßú·þ×

Advertisement
9
0478/22/O/N/24 · Question 11Oct/Nov 2024Paper 228 marks
Loading question…
Question text

11
A database table called Booking28 stores details of hotel rooms and bookings for the week
beginning Monday 7 July 2025.
RoomNo
Type
Guests
Rate$
Mon
Tue
Wed
Thu
Fri
Sat
Sun
101D
Double
2
99.99
T
T
T
T
F
T
T
102D
Double
2
99.99
T
T
T
F
T
T
T
103F
Family
4
150.00
T
T
T
T
T
T
T
104S
Single
1
72.50
F
T
T
F
T
T
T
105S
Single
1
72.50
F
T
T
F
T
T
T
106T
Twin
2
120.00
T
T
T
T
F
T
T
201F
Family
4
160.00
F
F
T
T
T
T
T
202D
Double
2
120.00
T
F
T
T
T
T
T
203T
Twin
2
120.00
T
F
T
T
T
T
T
204T
Twin
2
125.00
T
F
T
F
T
T
T
205S
Single
1
79.99
T
F
T
T
F
T
T
301D
Double
2
200.00
F
T
T
F
F
T
T
302T
Twin
2
200.00
T
T
T
T
F
T
T
303P
Suite
4
500.00
T
T
T
T
F
T
T
304P
Suite
6
700.00
F
F
F
F
T
T
T
(a) State the number of fields and records in this database table.
Fields …
Records …
[2]
(b) State the reason why the Type field would not be suitable as a primary key.
…
… [1]
ĬÑĊ®Ġ´íÈõÏĪÅĊÝû¸þ×
,
,
(c) The database uses only the data types:
•
alphanumeric
•
character
•
Boolean
•
integer
•
real
•
date/time.
Complete the table to show the fields that could have the given data types.
Only one field name is required in each box and each field name must be different.
Field
Data type
alphanumeric
Boolean
real
integer
[2]
(d) Give the output that would be produced by the structured query language (SQL) statement:
SELECT RoomNo, Type, Guests, Rate$
FROM Booking28
WHERE Mon <> T;
…
…
…
…
…
… [3]
ĬÓĊ®Ġ´íÈõÏĪÅĊÝù¸þ×

10
0478/23/O/N/24 · Question 4Oct/Nov 2024Paper 236 marks
Loading question…
Question text

4
Complete the paragraph about databases. Use terms from the list. You may need to use a term
more than once. Some of the terms in the list will not be used.
fields
comments
columns
constant
key
table
primary key
program
records
rows
scripts
database
validation
variable
Database tables consist of … and … .
Rows are … .
… are fields.
Structured query language (SQL) … are used to query data.
A … uniquely identifies a record.
[6]

11
0478/23/O/N/24 · Question 11Oct/Nov 2024Paper 237 marks
Loading question…
Question text

11
Building materials are sold in bags. A new database table called BuildStock has been set up to
store details about the materials for sale. Part of this table is given.
MtNo
Name
InStock
WeightKg
PricePerBag
NumberBags
MT01
Builders sand
Yes
50
4.50
50
MT02
Sharp sand
Yes
25
3.50
21
MT03
Red sand
No
50
2.75
0
MT04
Cement
No
25
6.85
0
MT05
Chippings
Yes
50
35.00
50
MT06
Cobbles
No
75
67.35
0
MT07
Pebbles small
Yes
50
34.50
3
MT08
Pebbles medium
Yes
25
25.50
10
MT12
Pebbles large
Yes
75
62.75
20
MT15
Washed gravel
Yes
50
12.75
12
MT16
Pea gravel
Yes
100
15.95
24
(a) Write the output from this structured query language (SQL) statement.
SELECT MtNo, Name
FROM BuildStock
WHERE WeightKg = 75
ORDER BY PricePerBag;
…
…
… [3]
(b) (i)
Complete this SQL statement to display only the names of all the materials that are out
of stock.
SELECT …
FROM …
WHERE …
[2]
(ii)
Explain how another SQL statement using a different field could be used to display the
same information.
…
…
…
… [2]
ĬÑĊ®Ġ´íÈõÏĪÅĊàù·þ×

12
0478/21/O/N/23 · Question 9Oct/Nov 2023Paper 2110 marks
Loading question…
Question text

9
A model shop wants to set up a database to help with stock control of the model figures available
for sale. The shop wants to store this information about the model figures:
Field 1 – catalogue number, for example MD1234
Field 2 – description, for example ‘small white dog’
Field 3 – number in stock, for example 5
Field 4 – the price of each model, for example 7.40
Field 5 – if the model has already been painted, yes or no.
(a) The shop needs five fields for each record.
Give a suitable name and data type for each field.
Field 1 name …
Data type …
Field 2 name …
Data type …
Field 3 name …
Data type …
Field 4 name …
Data type …
Field 5 name …
Data type …
[5]
(b) (i)
Give the name of the field that should be used for the primary key.
… [1]
(ii)
State why this field is used as the primary key.
… [1]
(c) Structured query language (SQL) is used to query data stored in this database.
State what these SQL commands are used for.
SELECT …
…
FROM …
…
WHERE …
…
[3]

13
0478/22/O/N/23 · Question 10Oct/Nov 2023Paper 228 marks
Loading question…
Question text

10 A database table called Horses stores details about the horses kept at a horse sanctuary.
Code
Breed
BreedOrigin
Gender
Age
Arrived
H002
Arabian
Saudi Arabia
M
5
28/09/2022
H004
Percheron
France
M
5
30/10/2022
H010
Friesian
Netherlands
M
6
15/11/2022
H011
Fjord
Norway
F
4
17/11/2022
H012
Clydesdale
Scotland
M
10
18/11/2022
H015
Arabian
Saudi Arabia
F
5
15/12/2022
H016
Arabian
Saudi Arabia
F
5
15/12/2022
H017
Clydesdale
Scotland
F
4
16/01/2023
H019
Percheron
France
M
3
16/01/2023
H025
Percheron
France
M
7
16/01/2023
H026
Clydesdale
Scotland
F
9
20/01/2023
H030
Clydesdale
Scotland
M
12
20/01/2023
H032
Fjord
Norway
M
3
24/03/2023
H033
Arabian
Saudi Arabia
F
15
27/04/2023
H034
Clydesdale
Scotland
F
4
14/06/2023
H035
Fjord
Norway
M
7
15/06/2023
H036
Friesian
Netherlands
F
15
20/07/2023
H037
Friesian
Netherlands
M
12
20/07/2023
(a) State the number of records in this database table.
… [1]
(b) Give the name of the field that is most suitable to be the primary key.
State the reason for this choice.
Field …
Reason …
…
[2]
(c) The database only allows the data types:
•
Boolean
•
character
•
date/time
•
integer
•
real
•
text.
Complete the table to show the most appropriate data type for each field.
Each data type must be different.
Field
Data type
Breed
Gender
Age
Arrived
[2]
(d) Complete the structured query language (SQL) to return the code and breed of all the horses
whose breed originated in Scotland.
… Code, Breed,
FROM …
WHERE … = "Scotland";
[3]

Advertisement
14
0478/23/O/N/23 · Question 9Oct/Nov 2023Paper 2311 marks
Loading question…
Question text

9
A sanctuary for pheasants has set up a new database table called PheasantList to store details
of the different species of bird at the sanctuary. Part of this table is given, showing: species,
description, number of birds at the sanctuary, if the birds are breeding or not, and number of
young born this year.
Species
Description
NumberBirds
Breeding
Young
Edwards
blue-black with white tail
5
Yes
0
Japanese green
dark green with pale grey tail
2
Yes
2
Reeves
golden, white and red scaled plumage
4
Yes
1
Crawfords Kalij
glossy blue-black plumage
4
No
0
Crested fireback
blue-black with black tail
3
No
0
True silver
white laced top half and black lower half
7
Yes
1
Siamese fireback
grey plumage with crimson legs and feet
5
No
0
Mikado
iridescent plumage with white striped wings
3
Yes
4
Red junglefowl
many colours
2
Yes
0
Himalayan monal
many colours with metallic green crest
3
Yes
2
White eared
white with ear tufts
5
Yes
3
Brown eared
brown with ear tufts
9
Yes
1
Ring necked
long tail with white ring neck
2
Yes
2
Golden
rainbow coloured
3
Yes
4
(a) State the number of records and fields in this part of the database table.
Records …
Fields …
[2]
(b) (i)
Give the name of a field that could be used for the primary key.
… [1]
(ii)
Explain why the sanctuary might decide not to use the field in (b)(i) as the primary key.
…
… [1]
(iii)
A new field SpeciesID is added to the database table.
This field contains a six-character code, for example Ph0001.
Give a reason why this field would be a better primary key.
…
… [1]
(c) Write the output that would be given by this structured query language (SQL) statement:
SELECT Species, Description
FROM PheasantList
WHERE NumberBirds > 6;
…
… [2]
(d) Complete this SQL statement to display all the species of pheasant where the birds are
breeding and there were no young born this year:
SELECT …
FROM …
WHERE …
… ;
[4]

15
0478/21/O/N/22 · Question 5Oct/Nov 2022Paper 215 marks
Loading question…
Question text

5
A database table, WAREHOUSE, is used to keep a record of items for sale. The table has these
fields:
•
ItemCode – code to identify each type of item
•
Description – brief description of each item
•
Manufacturer – name of manufacturer
•
Level – number in stock
•
Price – price in dollars ($).
(a) State which field you would choose for the primary key. Give a reason for your choice.
Field …
Reason …
…
[2]
(b) Complete the query-by-example grid to display only the item code and the manufacturer
where the number in stock is below 10.
Field:
Table:
Sort:
Show:
o
o
o
o
Criteria:
or:
[3]
Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
publisher will be pleased to make amends at the earliest possible opportunity.
To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge
Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download
at www.cambridgeinternational.org after the live examination series.
Cambridge Assessment International Education is part of Cambridge Assessment. Cambridge Assessment is the brand name of the University of Cambridge

Advertisement