2.3 Databases
2.3 Databases
10
7 A database, SOFASELECT, was set up to show the prices of suites, sofas and chairs for sale from
an online furniture warehouse. Part of the database is shown below.
...............................................................................................................................................[1]
(b) State which field you would choose for the primary key.
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[2]
(c) State the data type you would choose for each of the following fields.
Price in $ ..............................................................................................................................[2]
(d) The query-by-example grid below selects all the furniture in cream leather.
...................................................................................................................................................
...............................................................................................................................................[3]
(e) Complete the query-by-example grid below to select and show the brochure number, material,
colour and price of all the furniture with 3 or more seats.
Field:
Table:
Sort:
Show:
Criteria:
or:
[5]
5 A database table, SHEEP, is used to keep a record of the sheep on a farm. Each sheep has a
unique ear tag, EARnnnn; n is a single digit. The farmer keeps a record of the date of birth, the
gender and the current weight of each sheep in kilograms.
(a) Identify the four fields required for the database. Give each field a suitable name and data
type. Provide a sample of data that you could expect to see in the field.
(b) State the field that you would choose as the primary key.
...............................................................................................................................................[1]
(c) Using the query-by-example grid below, write a query to identify the ear tags of all male
sheep weighing over 10 kilograms. Only display the ear tags.
Field:
Table:
Sort:
Show:
Criteria:
or:
[3]
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.
(a) State the purpose of the primary key in the TOOLS table.
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [1]
(b) List the output from the data shown in the table TOOLS that would be given by this query-by-
example.
Sort: Descending
Show: ü ü ü
Criteria: >40 >0 >0
or:
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [3]
(c) Complete the query-by-example grid to output the tools where the quantity in stock is below
25. Only show the Code, Description and Quantity_Stock fields in ascending order of Code.
Field:
Table:
Sort:
Show:
Criteria:
or:
[3]
BLANK PAGE
BLANK PAGE
6 A database table, JUICE, is used to keep a record of cartons of fresh fruit juice available for sale.
(a) Identify a suitable field to use as the primary key. State a reason for your choice.
Field ..........................................................................................................................................
Reason ......................................................................................................................................
...................................................................................................................................................
[2]
(b) Complete the query-by-example grid to display only the stock level and size of all cartons
containing only apple juice.
Field:
Table:
Sort:
Show:
Criteria:
or:
[4]
BLANK PAGE
BLANK PAGE
6 Draw the flowchart symbol for Decision and the flowchart symbol for Process.
Decision Process
[2]
7 A convenience store which sells general groceries wants to set up a database table called
STOCK. The table will contain fields including a description of the item, the price of the item
and the number in stock for each item. The STOCK table also has a fourth field to be used as a
primary key.
(a) Complete the table to suggest a suitable field name for each of the four fields in the table
STOCK. Give the purpose of the data to be stored in each field.
[4]
(b) Complete the query-by-example grid to output stock items where the quantity in stock has
fallen below 20. Only show the primary key and description of the items.
Field:
Table:
Sort:
Show:
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
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.
6 A wildlife park has a database table, called LIVESTOCK, to classify and record its animal species.
Part of the database table is shown.
(a) Suggest another appropriate field that could be added to this database by stating its name
and data type. State its purpose and give an example of the data it could contain.
Purpose ....................................................................................................................................
...................................................................................................................................................
(b) Use the query-by-example grid below to provide a list of all four legged mammals that are
herbivores, sorted alphabetically by species, with only the species displayed.
Field:
Table:
Sort:
Show:
Criteria:
or:
[4]
6 A database table, TRAIN, is to be set up for a railway company to keep a record of the engines
available for use. Each engine has a unique number made up of 5 digits, nnnnn. The engines
are classified as freight (F) or passenger (P) together with a power classification that is a whole
number between 0 and 9, for example F8. The railway company keeps a record of the date of the
last service for each engine.
(a) Identify the three fields required for the database. Give each field a suitable name and data
type. Provide a sample of data that you could expect to see in the field.
(b) State the field that you should choose as the primary key.
...............................................................................................................................................[1]
(c) Using the query-by-example grid below, write a query to identify all passenger engines that
have not been serviced in the past 12 months. Only display the engine numbers.
Field:
Table:
Sort:
Show:
Criteria:
or:
[3]
BLANK PAGE