Chapter 9
Chapter 9
&+$37(5
3$*(
3$*(
12
5 The table, BEVERAGES, shows the number of calories in 100 ml of a range of popular beverages.
It also shows the availability of these drinks in a can, a small bottle and a large bottle.
............................
....
. ..
....
....................................................................................................................
...................................................................................................................................................
...
............
.. .........................................................
...................
. ..................
.....................................................
............................................................................................................................................. .......... [1]
(b) Stat
atte th
State the
e number
numb
nu mber
mberr of records
record
ds shown in the table BEVERAGES.
.......
...
. ......................................................................................................................................... [1]
.............................................................................................................................................
12
6 A database table, FLIGHT, is used to keep a record of flights from a small airfield. Planes can
carry passengers, freight or both. Some flights are marked as private and only carry passengers.
(a) State the field that could have a Boolean data type.
Field ...................................
................................................................................................... [1]
..
....................................................................................................................................
13
(b) A query-by-example has been written to display just the flight numbers of all planes leaving
after 10:00 that only carry passengers.
Show:
Criteria: =Y = 10:00
or:
Explanation ...............................................................................................................................
...................................................................................................................................................
...........................................
.........................................................................................................
...................................................................................................................................................
....................................
..................................................................................................................
....
...................................................................................................................................................
.........................
........
............................
. ..
....
. ....................
... ............
. ..
....
. ............................
................
. .........
................................................................................................................................................... ...............
Field:
Table:
So
ort
rt::
Sort:
Show:
Criteria:
or:
[7]
12
7 A database table, SALES, is used to keep a record of items made and sold by a furniture maker.
(a) Explain why the field Item numberr could not be used as a primary key.
...................................................................................................................................................
.........................................
........................................................................................................ [1]
.............................................................................................................................................
12
7 A teacher has decided to use a database table as her mark book for her Computer Science class,
which she has called MARKBOOK. For each student, the following data will be recorded: first
name, last name, their year 10 test score and their year 11 test score. The class has 32 students.
(a) State the number of fields and records required for this database.
(b) The data in MARKBOOK is stored under category headings: LastName, FirstName,
Y10TestScore and Y11TestScore.
State, with a reason, whether any of these headings would be suitable as a primary key.
...................................................................................................................................................
...................................................................................................................................................
...........................................
.........................................................................................................
...................................................................................................................................................
.......................................
.......................................................................................................... [2]
.............................................................................................................................................
Field:
Fie
eld:
eld:
d:
Table:
Tabl
ble:
ble
e:
Sort:
Show:
Criteria:
or:
[4]
Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
reasonable effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the
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 the Cambridge Assessment Group. Cambridge Assessment is the brand name of the University of
Cambridge Local Examinations Syndicate (UCLES), which itself is a department of the University of Cambridge.
12
6 A garden centre sells garden tools and stores details of these in a database table named TOOLS.
Code is the primary key in the TOOLS table.
...................................................................................................................................................
.............................................
.......................................................................................................
...................................................................................................................................................
............................................................................................................................................. [1]
13
6 A database table, JUICE, is used to keep a record of cartons of fresh fruit juice available for sale.
(a) Identify
fy
y a ssuitable
uita
ui ta
able
e fi
ffield
iel
eld to u
el se ass th
use the
e pr
rim
imaryy ke
primary key.
y S ta
ate a rreason
State ea
aso
on fo
for yo
you
ur cho
your oic
ice.
e
choice.
d ..
Field ..............
.........................
. .......................................................................................................
..........................................................................................................................................
Reas
Re ason
as
Reasonon
n .......................................................................................................................................
. ....
.. ..........
. ...........................................................................................................................
.....
...
.......
.............................................................................................................................................
...................................................................................................................................................
[2]
Field:
Table:
Sort:
Show:
Criteria:
or:
[4]
11
.............................................................................................................................................. [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]
12
(c) Complete the table to identify the most appropriate data type for each field based on the data
shown in the database table, 2018MOV.
CatNo
Title
Genre1
Streaming
[2]
Complete
(d) Compple e the
ete he structured
the struc
ruc
uctuured query
tu uery language
qu lang ge (SQL)
nguage (SQL to return
QL) returrn the
etu the category
categorry number
ateg
ateg er and
number d titlee for all
tittle
Comedy
Co
ome movies.
medyy m ovie
ie
es.
s
SELECT
LECT CatNo,
SEL
LE Cat
atNo
atNo, Title
No,
..................................................
.......
................................................ 20
2018MOV
2018
8MOV
..................................................;
WHERE Genre1 = ...........
........................................;
[2]
&+$37(5
0$5.,1*
6&+(0(
3$*(
3$*(
5(b) 10 records 1
5(d) 4
Field: BevNo BevName Calories
Sort: Ascending
Show: ; ;
Criteria: >45
or:
1mma
mark
ark
r for
forr correct
cor
orrrect Field
ld
d roww
1 ma
mark
rk for
for Table
Table and Sort
Sort rows
1 ma
m rk ffor
mark o ccorrect
or o rect Sho
or ow row
Show
1 mar
maark
rk ffor
mark o ccorrect
or orrect Crite
te
eria rows
Criteria
6(a) Passengers 1
6(b) Explanation 7
Three from:
x Flight number not displayed
x Passengers displayed when should not be
x Departure time = not >
x "Freight and passengers" flight not excluded
number
Field: Flight numb
ber
e Passengers Departure time Notes
Table: FLIGH
FLIGHT
HT FLIGHT FLIGHT FLIGHT
Sort:
Show:
Sh
how
ow:: ;
=Y >10:00 <> "Freight and
Criteria:
C
Crit
Crritter
eria:
eri
passengers"
or:
o r:
OR
Field: Flight numb
m er
number Departure time Notes
Table: FLIGHT
FLIGH
HT FLIGHT FLIGHT
Sort:
Show: ;
Criteria: >10:00 = "Passengers only"
6 Constants 6
Two from:
x The value cannot be changed accidentally «
x « during the execution of the program
x Value only needs to be changed once if circumstances change/during the
initialisation process
Variables
Two from:
x Stores a value that can change «
x « during the execution of the program
x Can use a variable without knowing its value
Arrays
Two from:
x A list of items of the same data type «
x « stored under a single name
x To reduce the num
number
mber of variables used
x Any item can be foundund using an index number to show its place in the list
fou
Questio Answer
A
An sw
wer
e Mark
Mark
M
n s
7(a) x N umbe
um be
b
Number er is repeated/not
repeate
ed/not unique 1
7(b)
b)) x IItem
tem number
tem
te numb
nu displayed/Amount
mber not dis
mb splayed/Amount column not required 5
x NNot
ot Like
Likke ‘Delivered’’ will
will also show cancelled items
Sort:
Show:
; ;
Criteria: Like "Not
started"
7(c) 4
Field: FirstName LastName Y10TestScore
Sort: Descending
Show:
; ; ;
Criteria: >=50
or:
6(c) 3
Field: Code Description
Des
escr
crip
cr ipti
ip tion
ti on Quantity_Stock
Qua
uant
ntit
nt ityy_St
it y_St
Stoc
occk
Sort: Ascending
Show: ; ; ;
3$*(
Criteria: <25
5
or:
6(a) One mark for field and one mark for reas
reason
asson 2
Field Juice code
Reason only unique identifier
6(b) 4
Field: Fruit 1 Fruit 2 Size Stock level
Sort:
Show: ; ;
or:
Question An
nsw
swer
e
Answer Marks
10 C 1
11(d) FROM 2
"Comedy"