Databases and SQL – A Level Computer Science (9618)

17 questions · page 1 of 2 · Clear filters

0 / 0Answer a question to start your score.
Quick quiz (10)Saved 0
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/12/M/J/26 · Question 3May/June 2026Paper 1216 marks
Loading question…
Question text

3
A computer game developer stores data about a computer game in a database. The database
has three entities:
•
the users, who are called players
•
the characters that users can create
•
the groups that users can create and allow characters to join.
(a) Describe the relationships between the three entities.
…
…
…
… [2]
(b) The database is created with four tables:
PLAYER(PlayerID, PlayerName, DateJoined)
CHARACTER(CharacterID, CharacterName, DateCreated, Level,
NumberOfPoints, PlayerID)
GROUP(GroupID, GroupName, Category)
CHARACTER_GROUP(CharacterGroupID, CharacterID, GroupID,
DateJoinedGroup)
Sample data for the table CHARACTER is given:
CharacterID
CharacterName
DateCreated
Level
NumberOfPoints
PlayerID
00123
Crystal
05/05/2025
5
35687
85AD
00124
Diamond
06/06/2025
4
21055
69CD
00125
Ruby
07/10/2025
1
1002
85AD
© Cambridge University Press & Assessment 2026
(i)
The given Structured Query Language (SQL) script is written to define the
table CHARACTER.
01
CREATE TABLE CHARACTER(
02
CharacterID INT,
03
CharacterName VARCHAR,
04
DateCreated DATE,
05
TheLevel INT,
06
NumberOfPoints INT,
07
PlayerID VARCHAR,
08
PRIMARY KEY CharacterID,
09
FOREIGN KEY(PlayerID)
10
);
The SQL script contains four errors.
Give the line number of each error and the corrected line.
error line 1 …
corrected line …
error line 2 …
corrected line …
error line 3 …
corrected line …
error line 4 …
corrected line …
[4]
(ii)
Write an SQL script to return each player’s name and the number of characters each
player has created.
The result needs to include a suitable field name for the number of characters.
Order the results in descending order of player ID.
…
…
…
…
…
… [5]
© Cambridge University Press & Assessment 2026
(c) Complete the description of database key terms by writing the missing words.
The … stores data about the data in the database. The table
names, field names and relationships will be stored. Two other examples of data that will be
stored are …

3
9618/13/M/J/26 · Question 4May/June 2026Paper 1317 marks
Loading question…
Question text

4
A database needs designing for a school library.
The library stores data about books including the author, title, category and number of pages.
The library will also store data about the students and the books they have borrowed. The data
needs to include the student’s name and student’s class.
Books are borrowed for 14 days. A book is late if it has not been returned within the 14 days. The
database needs to store whether the book is late, or not late.
(a) Create a 3-table design for the library database normalised to Third Normal Form (3NF).
Give your table design in the format:
TableName(Field1, Field2, Field3, …)
A primary key is underlined with a solid line.
A foreign key is underlined with a broken line.
table 1 …
…
…
table 2 …
…
…
table 3 …
…
…
[6]
(b) Explain the reasons why the library database should enforce referential integrity.
…
…
…
… [2]
© Cambridge University Press & Assessment 2026
,
,
© Cambridge University Press & Assessment 2026
,
,
(c) The school is also creating a database to store data about the departments, the staff and
classes in the school. The database is called SCHOOLDATA. The database has four tables:
STAFF(StaffID, FirstName, FamilyName, DepartmentID)
DEPARTMENT(DepartmentID, DepartmentName, DepartmentLeader)
CLASS(ClassID, YearGroup, SubjectCode)
SUBJECT(SubjectCode, SubjectName, DepartmentID)
(i)
The table shows some sample data for SUBJECT.
SubjectCode
SubjectName
DepartmentID
CS1
Computer Science IGCSE
ITCS
CS2
Computer Science IAS-level
ITCS
MA3
Mathematics IGCSE
MTS
ME4
Media IGCSE
ITCS
The Structured Query Language (SQL) scripts to create the database and the table
SUBJECT are shown.
01
CREATE DATA BASE SCHOOLDATA;
02
CREATE TABLE SUBJECT(
03
SubjectCode VARCHAR NONULL,
04
SubjectName VARCHAR
05
DepartmentID VARCHAR,
06
PRIMARY KEY (SubjectCode),
07
FOREIGN KEY (DepartmentID) REFERENCES (DepartmentID)
08
);
The SQL scripts contain four errors.
Give the line number of each error and the corrected line.
error line 1 …
corrected line …

Advertisement
4
9618/11/M/J/25 · Question 5May/June 2025Paper 1113 marks
Loading question…
Question text

5
A company builds and sells furniture to customers. The company stores data about customers,
their payment cards and their furniture orders in a database.
The database, FURNITURE, has the following tables:
CUSTOMER(CustomerID, Name, Phone)
CUSTOMER_CARD_DATA(CardID, CustomerID, CardType, CardNumber, EndDate)
ORDER(OrderID, CustomerID, TotalCost, Paid, OrderDate, Complete)
ORDER_ITEM(OrderItemID, OrderID, Type, Height, Width, Depth, Details)
The primary keys are underlined in each table.
The attribute Complete in the table ORDER stores the Boolean value TRUE if the order has been
built and FALSE if the order has not been built.
(a) Complete the entity‑relationship (E‑R) diagram for the database.
CUSTOMER
CUSTOMER_CARD_DATA
ORDER
ORDER_ITEM
[3]
(b) Identify one attribute in the table CUSTOMER_CARD_DATA that could be a candidate key.
… [1]
(c) Identify two tables in the database that contain one or more foreign keys.
Give one attribute that is a foreign key in each table.
Table
Foreign key
1
2
[2]
ĬÙĊ®Ġ´íÈõÏĪÅĊÞûµĀ×
,
,
(d) Explain the reasons why the data in the table ORDER_ITEM cannot be stored in the table
ORDER
…
…
…
…
…
… [3]
(e) Write an Structured Query Language (SQL) script to output the customer ID, the customer’s
name and the total cost of the customer’s orders that have not been paid.
The output of the total cost must have an appropriate title.
…
…
…
…
…
…
…
… [4]
ĬÛĊ®Ġ´íÈõÏĪÅĊÞùµĀ×

5
9618/12/M/J/25 · Question 5May/June 2025Paper 1216 marks
Loading question…
Question text

5
An online game has a database that stores data about users and the characters each user
creates in the game. Each user can create multiple characters and purchase multiple items for
each character.
The normalised database has the following design:
USER(Username, Password, DateOfBirth)
CHARACTER(CharacterName, CharacterID, Username, Level, Money)
ITEM(ItemName, MinimumLevel, Cost)
CHARACTER_ITEM(CharacterID, ItemName)
(a) Explain the purpose of the table CHARACTER_ITEM in the database.
…
…
…
… [2]
(b) Underline the attribute, or attributes, that form the primary key in each of the tables.
USER(Username, Password, DateOfBirth)
CHARACTER(CharacterName, CharacterID, Username, Level, Money)
ITEM(ItemName, MinimumLevel, Cost)
CHARACTER_ITEM(CharacterID, ItemName)
[2]
ĬÑĊ®Ġ´íÈõÏĪÅĊàúµĀ×
,
,
(c) A Database Management System (DBMS) provides data security.
(i)
Identify two methods the DBMS can use to protect the data in the table USER from
unauthorised access.
Explain how each method protects the data.
Method 1 …
Explanation …
…
…
Method 2 …
Explanation …
…
…
[4]
(ii)
The DBMS also supports data integrity.
Give two ways that a DBMS can support data integrity.
1 …
…
2 …
…
[2]
ĬÓĊ®Ġ´íÈõÏĪÅĊàüµĀ×
,
,
(d) (i)
Write a Structured Query Language (SQL) script to count the number of items purchased
by the user with the username "KAT123".
…
…
…
…

6
9618/13/M/J/25 · Question 6May/June 2025Paper 1318 marks
Loading question…
Question text

6
A shop sells pens to customers. Customers place an order with the shop and collect the items the
next day. The shop uses a database to store the information about the orders.
The database contains the following tables:
CUSTOMER(CustomerID, CustomerName, Email)
ORDER(OrderID, CustomerID, Date, Collected)
ORDER_PRODUCT(OrderID, ProductID, Quantity)
PRODUCT(ProductID, ProductName, QuantityInBox, Cost, SupplierID)
SUPPLIER(SupplierID, SupplierName, SupplierEmail)
The primary keys are underlined.
(a) Complete the entity-relationship (E-R) diagram for the database.
CUSTOMER
ORDER
SUPPLIER
ORDER_PRODUCT
PRODUCT
[4]
ĬÕĊ®Ġ´íÈõÏĪÅĊßú¶Ă×
,
,
(b) A new product needs to be entered into the database. The product has the ID 002323, the
product name ‘Blue ball point 2mm’, there are 50 in a box, the product costs $5.00 and the
supplier has the ID SFX223.
Write a Structured Query Language (SQL) script to enter the new product into the table
PRODUCT.
…
…
…
…
…
…
…
… [4]
(c) The attribute Collected in the table ORDER stores the Boolean value TRUE if the order has
been collected and FALSE if the order has not been collected.
Write an SQL script to return the customer name for each customer that has orders they
have not collected. Include the number of orders each customer has not collected with an
appropriate title.
An example output might be:
CustomerName
NotCollected
Jack Wright
2
Lin Cho
1
Santaya Yui
1
…
…
…
…
…
…
…
… [4]
Ĭ×Ċ®Ġ´íÈõÏĪÅĊßü¶Ă×
,
,
(d) The shop uses a Database Management System (DBMS).
(i)
One feature provided by a DBMS is a data dictionary.
The data dictionary stores the attribute names, table names, foreign keys a

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/12/M/J/24 · Question 4May/June 2024Paper 1211 marks
Loading question…
Question text

4
An assessment board wants to store the marks students achieved in exams in a database named
RECORDS.
Part of the database design includes these two tables:
EXAM(ExamID, Subject, Level, TotalMarks)
EXAM_QUESTION(ExamQuestionID, ExamID, QuestionNumber, Question, MaxMark)
(a) Identify the relationship between EXAM and EXAM_QUESTION.
…
… [1]
(b) Sample data for the table EXAM is shown:
ExamID
Subject
Level
TotalMarks
00956124
Computer Science 2
75
00956125
Computer Science 3
120
00956126
Mathematics
2
100
00956127
Mathematics
3
150
00956128
Physics
2
70
00956129
Physics
3
80
Write a Structured Query Language (SQL) script to define the table EXAM.
…
…
…
…
…
… [3]
(c) The table EXAM_QUESTION has been created but the foreign key has not been linked.
Write an SQL script to update EXAM_QUESTION and link the foreign key to EXAM.
…
…
…
… [2]
(d) The database also needs to store data about the students, the exams the students have
taken and the marks the students achieved in each question of each exam.
Describe the additional tables that will need to be included in the database and explain how
all the tables in the database will be linked.
…
…
…
…
…
…
…
…

Advertisement
9
9618/13/M/J/24 · Question 4May/June 2024Paper 1314 marks
Loading question…
Question text

4
A theatre wants to use a database to store data about the shows that are scheduled, their
customers and the seats that the customers have booked.
In the theatre:
•
Each show can take place on multiple dates.
•
Some dates can have more than one performance.
•
There are multiple rows of seats.
•
Each seat can be individually booked by its row letter and seat number, for example row E
seat 2.
Part of the database design includes these tables:
SHOW(ShowID, Title, Duration)
SEAT(SeatID, RowLetter, SeatNumber)
PERFORMANCE(PerformanceID, ShowID, ShowDate, StartTime)
(a) Identify the relationship between the tables PERFORMANCE and SHOW.
…
… [1]
(b) Sample data for the table PERFORMANCE is shown:
PerformanceID
ShowID
ShowDate
StartTime
0001
MK12
5/5/2025
13:00
0002
MK12
5/5/2025
19:30
0003
MK12
6/5/2025
19:00
0004
OP3
7/5/2025
18:30
0005
OP3
8/5/2025
18:30
0006
OP3
9/5/2025
13:00
Write a Structured Query Language (SQL) script to define the table PERFORMANCE.
…
…
…
…
…
…
…
…
… [4]
,
,
(c) Write an SQL script to return the number of times each show is scheduled. For example, in
the sample data in part (b), the show MK12 is scheduled three times.
The result needs to include the show name and a suitable field name for the number of times
it is scheduled.
…
…
…
…
…
…
…
…

10
9618/11/M/J/23 · Question 2May/June 2023Paper 1116 marks
Loading question…
Question text

2
An organisation uses a database to store data about the types of bird that people have seen.
(a) The database is managed using a Database Management System (DBMS).
(i)
State what is meant by a data dictionary and give one example of an item typically found
in a data dictionary.
Definition …
…
Example …
…
[2]
(ii)
State what is meant by data integrity and give one example of how this is implemented
in a database.
Definition …
…
Example …
…
[2]
(b) The database, Birds, stores information about the types of bird and the people who have
seen them.
Data about each bird seen is stored with its location and data about the person who saw the
bird.
Database Birds has the following tables:
BIRD_TYPE(BirdID, Name, Size)
BIRD_SEEN(SeenID, BirdID, Date, Location, PersonID)
PERSON(PersonID, FirstName, LastName, EmailAddress)
(i)
Complete the table by identifying two foreign keys and the database table where each is
found.
Foreign key
Database table
[2]
(ii)
The database Birds has been normalised.
Draw one line from each Normal Form to the most appropriate definition.
Normal Form
Definition
All fields are fully dependent on the primary key.
First Normal Form (1NF)
There are no repeating groups of attributes.
Second Normal Form (2NF)
There are no partial dependencies.
Third Normal Form (3NF)
[1]
(iii)
Part of the database table BIRD_TYPE is shown:
BirdID
Name
Size
0123
Blackbird
Medium
0035
Jay
Large
0004
Raven
Large
0085
Robin
Small
The database only supports these data types:
•
character
•
varchar
•
Boolean
•
integer
•
real
•
date
•
time
Write a Structured Query Language (SQL) script to define the table Bird_Type.
…
…
…
…
…
…
…
… [4]
(iv)
The database tables are repeated here for reference:
BIRD_TYPE(BirdID, Name, Size)
BIRD_SEEN(SeenID, BirdID, Date, Location, PersonID)
PERSON(PersonI

11
9618/12/M/J/23 · Question 2May/June 2023Paper 1217 marks
Loading question…
Question text

2
A horse riding school uses a database, Lessons, to store data about lesson bookings.
This database is created and managed using a Database Management System (DBMS).
(a) The table contains names and descriptions of DBMS features and tools.
Complete the table by writing down the missing names and descriptions.
Name
Description
…
Data dictionary
…
…
…
Query processor
…
…
…
A model of a database that is not specific to one DBMS.
…
…
A software tool that allows the user to create items such as
tables, forms and reports.
…
[4]
(b) Explain the reasons why referential integrity is important in a database.
…
…
…
…
…
… [3]
(c) The database Lessons has the following tables:
HORSE(HorseID, Name, Height, Age, HorseLevel)
STUDENT(StudentID, FirstName, LastName, RiderLevel, PreferredHorseID)
LESSON(LessonID, Date, Time, StudentID, HorseID, LessonContent)
Dates in this database are stored in the format #DD/MM/YYYY#.
The fields RiderLevel and HorseLevel can only have the values: Beginner,
Intermediate or Advanced.
(i)
Describe two methods of validating the field RiderLevel.
1 …
…
…
2 …
…
…
[2]
(ii)
Write a Structured Query Language (SQL) script to return the names of all the horses
that have the horse level intermediate or beginner.
…
…
…

12
9618/13/M/J/23 · Question 4May/June 2023Paper 1317 marks
Loading question…
Question text

4
A shop rents cars to customers. The shop uses a relational database to store information about
the rentals.
(a) Describe two ways in which a relational database addresses the limitations of a file-based
approach.
1 …
…
…
…
2 …
…
…
…
[4]
(b) Complete the table by writing the missing term or description for each database feature.
Term
Description
…
An object that data is stored about.
…
…
Tuple
…
…
…
Secondary key
…
…
…
A field in one table that is linked to a primary key in another
table.
…
[4]
(c) The car rental database is not normalised. The current database design is:
BOOKING(CarRegistration, StartDate, EndDate,
CarModel, CarColour, CustomerFirstName)
CUSTOMER(CustomerFirstName, CustomerLastName, EmailAddress,
TelephoneNumber)
Write a normalised database design for this database.
All tables must be in Third Normal Form (3NF).
Use the field names given and underline the primary key fields.
…
…
…
…
…
…
…
…

13
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
14
9618/12/M/J/22 · Question 5May/June 2022Paper 1217 marks
Loading question…
Question text

5
A database, FILMS, stores information about films and actors.
Part of the database is shown:
ACTOR(ActorID, FirstName, LastName, DateOfBirth)
FILM_FACT(FilmID, FilmTitle, ReleaseDate, Category)
FILM_ACTOR(ActorID, FilmID)
(a) Complete the entity-relationship (E-R) diagram.
FILM_FACT
ACTOR
FILM_ACTOR
[2]
(b) A composite primary key consists of two or more attributes that together form the primary key.
Explain why the table FILM_ACTOR has a composite primary key.
…
…
…
… [2]
(c) Complete the SQL script to return the IDs of all the actors in the film with the title Cinderella.
SELECT …
FROM FILM_ACTOR
INNER JOIN …
ON FILM_FACT.FilmID = …
WHERE FILM_FACT.FilmTitle = … ;
[4]
(d) Write an SQL script to count the number of films that were released in January 2022.
…
…
…
…
…
… [3]
(e) A Database Management System (DBMS) is used to create and manipulate the database.
Complete the descriptions of the features and tools found in a DBMS using the given terms.
Not all terms will be used.
Boolean
data dictionary
data redundancy
field names
input
interface
logical schema
normalisation
operating system
output
primary keys
query
structure
A DBMS provides data management. This includes the development of a
… that stores information about the data stored, such as
… and … .
The … uses methods, such as an E-R diagram, to show the
structure of the database and its relationships.
The … processor allows a user to perform searches to find
specific data. The DBMS also provides a developer … that
allows the user to create tables, forms and reports.
[6]

15
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)
…
…
…

Advertisement