Databases and SQL – A Level Computer Science (9618)
31 questions · page 2 of 3
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]
Question text
2
(a) State what is meant by the following terms in a relational database model.
Entity …
…
…
Primary key …
…
…
Referential integrity …
…
…
[3]
(b) Authentication is one method a Database Management System (DBMS) can use to improve
the security of a database.
Describe other methods that a DBMS can use to improve the security of a database.
…
…
…
…
…
…
…
… [4]
(c) The following database table is not normalised.
StudentName
DateOfBirth
TutorGroup
Subject
SubjectCode
English, Maths,
Yuwei Chen
01/09/2004
SMH
EN, MA, CS
Computer Science
Claudia Raj
23/02/2005
JMB
Maths, Physics, Art
MA, PY, AR
Art, Design, English
Aamil Akram
24/01/2005
KMB
AR, DE, EN
language
English language,
Areeba Faraz
21/12/2004
SMH
EN, CH, DE
Chemistry, Design
Explain how to modify the table to put it into First Normal Form (1NF).
…
…
…
…
…
…
Question text
3
A company sells online Computer Science courses to students in different countries.
The courses are stored on a public cloud.
(a) (i)
Explain why the company uses a public cloud to store these courses.
…
…
…
… [2]
(ii)
Describe two disadvantages of storing data on a public cloud compared to storing data
on a server in a Local Area Network (LAN).
1 …
…
…
…
2 …
…
…
…
[4]
(iii)
State how the following security measures can be used to protect computer systems.
Firewall …
…
Encryption …
…
Passwords …
…
[3]
(b) The company uses a database, COURSES, to store data about the courses and their tutors.
Each course starts at different times of the year and may have a different tutor.
The database has the following structure:
COURSE_INFORMATION(CourseID, Description, Cost)
TUTOR(TutorID, TelephoneNumber, EmailAddress, TutorName)
COURSE_SCHEDULE(CourseID, DateStarted, TutorID)
(i)
Complete the entity‑relationship (E‑R) diagram for the database COURSES.
COURSE_SCHEDULE
TUTOR
COURSE_INFORMATION
[1]
(ii)
Write the Structured Query Language (SQL) script to return the total number of courses
that have started after 9 September 2023.
The value returned must have an appropriate field name.
…
…
…
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
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.
…
…
…
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.
…
…
…
…
…
…
…
…
Question text
4
A photographer creates a relational database to store data about photographs taken at birthday
parties.
The database, PHOTOGRAPHS, stores details of the customer, the party, the photographs taken
and the cameras used.
The photographer has several cameras that are used for taking the photographs at the parties.
Each camera has a specific lens type (for example, XY32Z) and lighting type (for example, F1672).
Data about each photograph is stored in the database including the party at which it was taken,
the time it was taken and the camera used.
The database has these four tables:
CUSTOMER(CustomerID, FirstName, LastName, Telephone)
PARTY(PartyID, CustomerID, PartyDate, StartTime)
PHOTO_DATA(PhotoID, PartyID, TimeTaken, CameraID)
CAMERA_DATA(CameraID, LensType, LightingType)
(a) Complete the entity-relationship (E-R) diagram for the database PHOTOGRAPHS.
PARTY
CUSTOMER
PHOTO_DATA
CAMERA_DATA
[3]
(b) The database is normalised and is in Third Normal Form (3NF).
Describe the characteristics of a database that is in Third Normal Form (3NF).
…
…
…
…
…
… [3]
(c) The table shows some sample data for the table PHOTO_DATA.
PhotoID
PartyID
TimeTaken
CameraID
ST23-56
BD987
08:34
NIK-02
ST23-57
BD987
08:55
NIK-02
ST23-60
BC08
09:01
CAN-01
ST23-61
BC08
10:23
CAN-12
ST23-62
BC08
10:56
NIK-01
(i)
State what is meant by a tuple. Give an example of a tuple from PHOTO_DATA.
Tuple …
…
Example …
…
[2]
(ii)
Complete the Structured Query Language (SQL) script to display the total number of
photographs that have been taken using a camera with a camera ID starting with CAN.
SELECT … ( … )
FROM …
WHERE CameraID LIKE … ;
[4]
(d) Write an SQL script to include two new fields in CAMERA_DATA to store the number of
photographs currently on the camera and the date the camera was last used.
…
…
…
…
Question text
5
A relational database, GARDEN, has the following tables:
OWNER(OwnerID, FirstName, TelephoneNo, TreeID, TreePosition)
TREE(TreeID, ScientificName, MaxHeight, FastGrowing)
(a) The database is not in Third Normal Form (3NF).
Explain how the database can be normalised to 3NF.
…
…
…
…
…
… [3]
(b) Write the Structured Query Language (SQL) script to add a new record in the table TREE to
store the following data:
Attribute
Value
TreeID
LOW_1276
ScientificName
Salix_Alba
MaxHeight
30.00
FastGrowing
TRUE
…
…
…
… [3]
(c) State what is meant by a candidate key in a relational database.
…
… [1]
(d) (i)
Describe, using an example, what is meant by a data dictionary.
…
…
…
… [2]
(ii)
Describe what is meant by a logical schema.
…
…
…
… [2]
Question text
2
The relational database ASTRONOMY is used to store data about telescopes, the companies that
own the telescopes and the photographs taken by the telescopes.
The database has these three tables:
COMPANY(TelephoneNumber, CompanyID, CompanyName)
PHOTOGRAPH(PhotoID, TelescopeID, DateTaken, TimeTaken, Elevation)
TELESCOPE(TelescopeID, CompanyID, SerialNumber)
(a) Complete the following table by writing the correct answer for each item.
Item
Answer
a suitable field for the primary key in
COMPANY
a candidate key in TELESCOPE
the degree of relationship between
TELESCOPE and PHOTOGRAPH
[3]
(b) A Database Management System (DBMS) has several features.
Identify the feature that describes the relationship between data and its structure.
… [1]
(c) Complete the SQL script to return the total number of telescopes owned by the company
whose ID begins with HW.
SELECT … ( … )
FROM TELESCOPE
WHERE … LIKE … ;
[4]
(d) Write the SQL script to add one field to the table PHOTOGRAPH to store the resolution of the
photograph, e.g. 1920 × 1068.
…
…
…
… [2]
(e) The photographs are stored as bitmap images.
Complete the statements about bitmap images by writing the missing words.
The … of a bitmap image is the number of
bits that are used to store each pixel.
Metadata about the image is stored in the …
of the file.
[2]
(f)
Describe the purpose of a query processor in a DBMS.
…
…
…
… [2]
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]
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]
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)
…
…
…
Question text
5
Javier owns many shops that sell cars. He employs several managers who are each in charge of
one or more shops. He uses the relational database CARS to store the data about his business.
Part of the database is shown:
SHOP(ShopID, ManagerID, Address, Town, TelephoneNumber)
MANAGER(ManagerID, FirstName, LastName, DateOfBirth, Wage)
CAR(RegistrationNumber, Make, Model, NumberOfMiles, ShopID)
(a) Tick ( ) one box in each row to identify whether each field is a primary key or a foreign key.
Table
Field name
Primary key
Foreign key
MANAGER
ManagerID
SHOP
ManagerID
CAR
RegistrationNumber
CAR
ShopID
[2]
(b) Describe the ways in which access rights can be used to protect the data in Javier’s database
from unauthorised access.
…
…
…
…
…
… [3]
(c) Javier uses Data Definition Language (DDL) and Data Manipulation Language (DML)
statements in his database.
(i)
Complete the following DML statements to return the number of cars for sale in each
shop.
SELECT COUNT( … )
FROM …
… ShopID
[3]
(ii)
Complete the DML statement to include the following car in the table CAR.
Field
Data
RegistrationNumber
123AA
Make
Tiger
Model
Lioness
NumberOfMiles
10500
ShopID
12BSTREET
…
… CAR
… ("123AA","Tiger","Lioness",10500,"12BSTREET")
[2]
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]
Question text
7
Bobby and Kim are discussing databases.
(a) Bobby tells Kim that a file-based approach is usually better than a relational database.
Explain why Bobby is incorrect.
…
…
…
…
…
… [3]
(b) Bobby has a shop that sells products to customers. His database will store data about his
customers, their payment details, orders and the products he sells. Customers will have login
details to access their accounts. The database will update customers’ payment and login
details without keeping any historical records.
(i)
Give one example of each of the following relationships from Bobby’s database.
one-to-one
…
…
one-to-many
…
…
many-to-many
…
…
[3]
(ii)
Tick (3) one box to identify the relationship that cannot be directly implemented in a
normalised relational database.
Relationship
Tick (3)
one-to-one
one-to-many
many-to-many
[1]
(iii)
Bobby wants to name his database SHOPORDERS.
Write a Data Definition Language (DDL) statement to define a new database with the
name SHOPORDERS.
…
… [1]
(c) A database has a data dictionary.
Give three items that are stored in a data dictionary.
1 …
2 …
3 …
[3]