Databases and SQL – A Level Computer Science (9618)

10 questions

0 / 0Answer a question to start your score.
New quizSaved 0

Quick quiz: 10 random questions from this topic. Answer them all, then open the Summary.

Advertisement
1
9618/11/M/J/26 · Question 4May/June 2026Paper 1118 marks
Loading question…
Question text

4
A shop allows customers to pay to borrow toys. The shop uses a database to record information
about the customers and the toys they have borrowed.
CUSTOMER(CustomerID, ContactFirstName, Phone)
TOY(ToyID, ToyName, CostPerDay)
TOY_INSTANCE(UniqueToyID, ToyID, Quality)
BORROW(BorrowID, CustomerID, UniqueToyID, StartDate, NumberDays)
(a) Complete the table by describing the relationship between each pair of tables. Include the
primary key(s) and foreign key(s) and how these create each relationship.
pair of tables
description of relationship
…
CUSTOMER
…
and BORROW
…
…
…
TOY_INSTANCE
…
and TOY
…
…
[4]
(b) Write a Structured Query Language (SQL) script to return the total number of days of all toys
borrowed by each customer. The customer ID and first name for each customer also need to
be returned.
The result needs to include a suitable field name for the total number of days.
…
…
…
…
…
…
… [4]
© Cambridge University Press & Assessment 2026
,
,
(c) The table BORROW needs amending to include an additional field.
(i)
The field will store whether the toy has been returned and will store either Yes or No.
Write an SQL script to include the additional field in the table BORROW.
…
…
… [2]
(ii)
The toy that was borrowed with the borrow ID A2226 has been returned.
Write an SQL script to amend the record and store that the toy has been returned.
…
…
…

2
9618/13/M/J/22 · Question 6May/June 2022Paper 1313 marks
Loading question…
Question text

6
A relational database, TECHNOLOGY, stores data about the staff in a company and the computer
devices used by the staff.
The database has the following tables:
STAFF(StaffID, FirstName, LastName, DateOfBirth, JobTitle)
DEVICE(DeviceID, Type, DatePurchased, StaffID)
(a) Describe the relationship between the two tables. Refer to the primary and foreign keys in
your answer.
…
…
…
…
…
…
…
… [4]
(b) The database uses a Data Definition Language (DDL) and Data Manipulation Language
(DML).
(i)
Complete the SQL script to return the number of devices stored in the database for the
staff member with the first name ‘Ali’ and last name ‘Khan’.
SELECT … (STAFF.StaffID)
FROM …
INNER JOIN DEVICE
… STAFF.StaffID = DEVICE.StaffID
WHERE STAFF.FirstName = 'Ali'
… STAFF.LastName = 'Khan';
[4]
(ii)
The table DEVICE needs a new attribute to store whether the device has been returned
by the staff member, or not.
Write a Structured Query Language (SQL) script to insert the new attribute into the table
DEVICE.
…
…
…
… [2]
(c) The database is in Third Normal Form (3NF).
Complete the table by describing the three normal forms.
Normal Form
Description
…
…
First Normal Form (1NF)
…
…
…
…
Second Normal Form (2NF)
…
…
…

3
9618/12/M/J/21 · Question 1May/June 2021Paper 1216 marks
Loading question…
Question text

1
Raj owns houses that other people rent from him. He has a database that stores details about
the people who rent houses, and the houses they rent. The database, HOUSE_RENTALS, has the
following structure:
CUSTOMER(CustomerID, FirstName, LastName, DateOfBirth, Email)
HOUSE(HouseID, HouseNumber, Road, Town, Bedrooms, Bathrooms)
RENTAL(RentalID, CustomerID, HouseID, MonthlyCost, DepositPaid)
(a) Give the definition of the following database terms, using an example from the database
HOUSE_RENTALS for each definition.
Term
Definition and example
…
Field
…
…
…
Entity
…
…
…
Foreign key
…
…
[6]
(b) Tick (3) one box to identify whether the database HOUSE_RENTALS is in Third Normal Form
(3NF) or not in 3NF.
Justify your choice using one or more examples from the database HOUSE_RENTALS.
In 3NF
Not in 3NF
Justification …
…
…
… [2]
(c) Example data from the table RENTAL are given:
RentalID
CustomerID
HouseID
MonthlyCost
DepositPaid
1
22
15B5L
1000.00
Yes
2
13
3F
687.00
No
3
1
12AB
550.00
Yes
4
3
37
444.50
Yes
(i)
Complete the following Data Definition Language (DDL) statement to define the table
RENTAL.
CREATE … … (
RentalID INTEGER NOT NULL,
CustomerID INTEGER NOT NULL,
HouseID … (5) NOT NULL,
MonthlyCost … NOT NULL,
DepositPaid BOOLEAN NOT NULL,
… (RentalID)
);
[4]
(ii)
Write a Data Manipulation Language (DML) script to return the first name and last name
of all customers who have not paid their deposit.
…
…
…
…
…

Advertisement
4
9618/11/O/N/23 · Question 3Oct/Nov 2023Paper 1111 marks
Loading question…
Question text

3
A shop manager has designed a relational database to store customer orders.
The database will have the following tables:
CUSTOMER(CustomerID, FirstName, LastName, Town)
SHOP_ORDER(OrderNo, CustomerID, OrderDate)
SUPPLIER(SupplierID, EmailAddress, TelephoneNumber)
ITEM(ItemNumber, SupplierID, Description, Price)
ORDER_ITEM(ItemNumber, OrderNo, Quantity)
(a) Complete the entity-relationship (E-R) diagram for the relational database.
CUSTOMER
SHOP_ORDER
ORDER_ITEM
SUPPLIER
ITEM
[3]
(b) Identify three advantages of a relational database compared to a file-based approach.
1 …
…
2 …
…
3 …
…
[3]
(c) (i)
Write a Structured Query Language (SQL) script to define the database called SHOP.
…
… [1]
(ii)
Write the SQL script to return the total quantity of items that the customer with the ID of
HJ231 has ordered.
…
…
…
…
…
… [4]

5
9618/13/O/N/25 · Question 5Oct/Nov 2025Paper 1316 marks
Loading question…
Question text

5
A company creates a relational database to store data about its customers.
The database, REVIEWS, stores data about the customers, products, complaints and staff.
The database has four tables:
CUSTOMER(CustomerID, CustomerFirstName, CustomerLastName, CustomerEmail)
PRODUCT(ProductID, ProductName, ProductDetail, Price, Rating)
COMPLAINT(ComplaintID, ProductID, CustomerID, ComplaintDetails, StaffID)
STAFF(StaffID, StaffFirstName, StaffLastName, Department, RemoteWorker)
(a) Complete the entity‑relationship (E‑R) diagram for the database REVIEWS.
CUSTOMER
PRODUCT
COMPLAINT
STAFF
[3]
ĬÑĊ®Ġ´íÈõÏĪÅĊÝùµþ×
,
,
(b) Some example data from the STAFF table is shown.
StaffID
StaffFirstName
StaffLastName
Department
RemoteWorker
1
Ralph
Jura
E
Yes
2
Luca
Emcee
A
Yes
3
Darwin
Acula
F
No
Write a Structured Query Language (SQL) script to define the table STAFF.
…
…
…
…
…
…
…
…
…
…
…
… [4]
(c) Products are given a rating between 1 and 10 inclusive.
Write an SQL script to return only the ProductID, ProductName and ComplaintDetails
for all products with a rating of 5 or less. The results need to be displayed in descending order
of rating.
…
…
…
…
…
…
…
…

6
9618/12/O/N/21 · Question 6Oct/Nov 2021Paper 1215 marks
Loading question…
Question text

6
A shop sells plants to customers. The shop manager has a relational database to keep track of the
sales.
The database, PLANTSALES, has the following structure:
PLANT(PlantName, QuantityInStock, Cost)
CUSTOMER(CustomerID, FirstName, LastName, Address, Email)
PURCHASE(PurchaseID, CustomerID)
PURCHASE_ITEM(PurchaseID, PlantName, Quantity)
(a) The database is normalised.
(i)
The table lists the following three stages of normalisation:
•
The first stage is from a database that is not normalised (0NF) to First Normal Form
(1NF).
•
The second stage is from 1NF to Second Normal Form (2NF).
•
The third stage is from 2NF to Third Normal Form (3NF).
Tick (  ) one box in each row to identify the appropriate stage for each task.
Normalisation stage
Task
0NF to 1NF
1NF to 2NF
2NF to 3NF
Remove any partial key dependencies
Remove any repeating groups of attributes
Remove any non-key dependencies
[2]
(ii)
Draw an entity-relationship (E-R) diagram for the database PLANTSALES.
CUSTOMER
PLANT
PURCHASE_ITEM
PURCHASE
[3]
(b) The shop manager uses a Database Management System (DBMS).
Describe the purpose and contents of the data dictionary in the DBMS.
…
…
…
…
…
… [3]
(c) The shop manager uses both Data Definition Language (DDL) and Data Manipulation
Language (DML) statements to create and search the database.
(i)
Complete the DML statements to return the total number of items purchased with the
purchase ID of 3011A.
SELECT SUM( … )
FROM …
WHERE … = … ;
[4]
(ii)
Write DDL statements to include a field in the table PURCHASE to store the date of the
order.
…
…
…
… [3]

7
9618/11/M/J/24 · Question 6May/June 2024Paper 1115 marks
Loading question…
Question text

6
A company is developing a website that will allow users to create an account and then play a quiz
every day. The data about the users and the quizzes are stored in a database.
A user must select a unique username and enter a valid email address to create an account. All
users must be over the age of 16. A new quiz is given to the users every day. Each quiz is stored
in its own text file.
The database stores the filename of each quiz and the date it can be played. The user gets a
score for each quiz they complete, which is stored in the database. The scores are used to give
each user a rating, for example Gold.
(a) Create a 3-table design for this database normalised to Third Normal Form (3NF).
Give your table design in the format:
TableName(PrimaryKey, Field1, Field2, …)
…
…
…
…
…
…
…
…
…
… [6]
(b) The company is using a Database Management System (DBMS) to set up the database.
Describe what is meant by the following DBMS features:
Data dictionary …
…
…
…
Logical schema …
…
…
…
[4]
(c) The company has another database, FARMING, for a different game.
The database FARMING has a table named EVENT which is shown with some sample data.
PlayerID
EventID
Category
Points
000123
3
Build
100
000124
1
Grow
36
000123
4
Grow
22
000123
7
Create
158
000125
3
Grow
85
000125
4
Build
69
The database FARMING has a second table created named PLAYER that has the primary
(i)
key PlayerID.
The field P

8
9618/11/O/N/25 · Question 2Oct/Nov 2025Paper 1113 marks
Loading question…
Question text

2
A relational database, WORKEXPERIENCE, stores data about students and the companies where
they complete work experience.
Students can complete multiple work experience placements but can only complete one placement
at a time.
Students can complete more than one placement at the same company.
Part of the database is shown:
STUDENT(StudentID, FirstName, TelephoneNumber, UniversityName)
PLACEMENT( PlacementID, StudentID, CompanyID, StartDate, EndDate,
Complete)
COMPANY(CompanyID, CompanyName, MaxStudentsPerPlacement)
(a) Complete the entity-relationship (E-R) diagram for the database WORKEXPERIENCE.
STUDENT
PLACEMENT
COMPANY
[2]
(b) Explain why the database WORKEXPERIENCE is in Third Normal Form (3NF).
…
…
…
… [2]
ĬÍĊ®Ġ´íÈõÏĪÅĊàû·Ā×
,
,
(c) Some example data from the PLACEMENT table is shown:
PlacementID
StudentID
CompanyID
StartDate
EndDate
Complete
PC001
LDEA01
MSCM
01/01/2023
12/07/2023
TRUE
PC002
LDEA01
MSCM
01/04/2024
08/05/2024
FALSE
PC003
ALAU02
NEAM
09/03/2020
10/03/2021
FALSE
PC004
LOLI75
GOUZ
07/06/2018
11/09/2018
TRUE
(i)
Write a Structured Query Language (SQL) script to delete all placements that have been
completed.
…
…
…
… [2]
(ii)
Write an SQL script to return the total number of placements completed by the student
with ID LDEA01 at the company with ID NEAM. The total should be given an appropriate
name.
…
…
…
…
…
… [4]
ĬÏĊ®Ġ´íÈõÏĪÅĊàù·Ā×
,
,
(d) The database tables are repeated here:
STUDENT(StudentID, FirstName, TelephoneNumber, UniversityName)
PLACEMENT( PlacementID, StudentID, CompanyID, StartDate, EndDate,
Complete)
COMPANY(CompanyID, CompanyName, MaxStudentsPerPlacement)
Explain what is meant by referential integrity, and how it applies to this database.
…
…
…

Advertisement
9
9618/13/O/N/24 · Question 4Oct/Nov 2024Paper 1319 marks
Loading question…
Question text

4
A company makes ice cream and sells it to shops.
The ice cream is made in batches: a large quantity of one type and flavour of ice cream that is
then split into smaller quantities for sale.
The company’s owner has designed a relational database, ICECREAM, to store data about their
ice cream and customers.
Some of the tables in the database are given. The database is not normalised.
BATCH(BatchID, Type, Flavour, Size, SellingPrice, EndDate)
CUSTOMER(CustomerID, CompanyName, EmailAddress, TelephoneNumber)
SALE(SaleID, BatchID, CustomerID, Quantity, Date)
(a) Identify two foreign keys in the table SALE and the table that each foreign key references.
Foreign key 1 …
Table name 1 …
Foreign key 2 …
Table name 2 …
[2]
(b) Write an SQL script to return the total quantity of ice cream sold to the customer with the ID of
0034E in the year 2023.
…
…
…
…
…
… [3]
Ĭ×Ċ®Ġ´íÈõÏĪÅĊàû¸Ā×
,
,
(c) The table definition for BATCH is repeated here:
BATCH(BatchID, Type, Flavour, Size, SellingPrice, EndDate)
Sample data for the table BATCH is given:
BatchID
Type
Flavour
Size
SellingPrice
EndDate
KlV12
Plain
Vanilla
1
2.20
12/12/2024
RlC14
Plain
Chocolate
0.5
1.80
12/12/2024
TYL1
Non-dairy
Lemon
0.5
2.10
01/02/2025
FYV2
Non-dairy
Vanilla
0.25
1.50
02/02/2025
BIV13
Plain
Vanilla
1
2.20
02/02/2024
(i)
Write an SQL script to define the table BATCH.
Include constraints (restrictions) on the data that can be entered into each field where
appropriate.
…
…
…
…
…
…
…
…
…

10
9618/11/M/J/22 · Question 4May/June 2022Paper 1119 marks
Loading question…
Question text

4
A teacher uses a relational database, MARKS, to store data about students and their test marks.
The database has the following structure:
STUDENT(StudentID, FirstName, LastName)
TEST(TestID, Description, TotalMarks)
STUDENT_TEST(StudentID, TestID, Mark)
(a) Describe the advantages of using a relational database compared to a file-based approach.
…
…
…
…
…
…
…
…
…
… [4]
(b) Give the highest level of Normal Form (NF) the database MARKS is in and justify your choice.
Normal Form …
Justification …
…
…
[3]
(c) (i)
Sample data to be stored in the table STUDENT_TEST is shown.
StudentID
TestID
Mark
12
A1
50
12
P10
100
13
A1
75
14
P10
60
Write a Structured Query Language (SQL) script to create the table STUDENT_TEST.
…
…
…
…
…
…
…
…
… [5]

Advertisement