Databases and SQL – A Level Computer Science (old syllabus, to 2021) (9608)
13 questions · Clear filters
Question text
9
An airline company uses a relational database to store data about passengers and flights.
Part of the database is shown.
PASSENGER(PassengerID, FirstName, LastName)
FLIGHT(FlightID, FlightDate, FlightTime)
PASSENGER_LIST(FlightID, PassengerID, SeatNo)
(a) Complete the entity-relationship (E-R) diagram to show the relationships between the given
tables.
PASSENGER
FLIGHT
PASSENGER_LIST
[2]
(b) The following is example data for the table FLIGHT:
FlightID
FlightDate
FlightTime
MO126
05/05/21
09:00
GK6708
06/09/21
00:30
BA0897
08/12/21
15:30
Write Data Definition Language (DDL) statements to define the table FLIGHT.
…
…
…
…
…
…
… [5]
Question text
8
An employment agency keeps records of its contracts with employers and workers in a relational
database.
These are some of the tables in the database:
EMPLOYER(EmpId, EmpName, EmpAddress, EmpPhoneNumber)
WORKER(WkId, WkFirstName, WkLastName, WkAddress, WkPhoneNumber)
CONTRACT_TYPE(ConTypeId, ConName)
CONTRACT(ConId, ConTypeId, EmpId, WkId, RefConNumber)
(a) Complete the entity-relationship (E-R) diagram for this part of the database.
EMPLOYER
WORKER
CONTRACT
CONTRACT_TYPE
[3]
(b) Write a Data Definition Language (DDL) statement to change the CONTRACT table to remove
the attribute RefConNumber.
…
…
…
… [2]
(c) The following table has examples of DDL and Data Manipulation Language (DML) statements.
Tick (✓) one box in each row to identify whether each statement is an example of DML or
DDL.
Statement
DML
DDL
ADD PRIMARY KEY
ALTER TABLE
SELECT FROM
INNER JOIN
CREATE DATABASE
[2]
(d) The field WkPhoneNumber cannot be empty and must have a maximum of 14 characters.
Describe two ways the field WkPhoneNumber can be validated.
1 …
…
…
…
2 …
…
…
…
[4]
(e) State what is meant by a candidate key.
…
… [1]
(f)
Describe what is meant by a secondary key.
…
…
…
… [2]
(g) The database is stored on a magnetic hard disk.
Describe the basic internal layout and operation of a magnetic hard disk drive.
…
Question text
9
A company uses a relational database.
(a) The company stores data about its customers and their bank details.
Explain the ways in which the database can be set up to only allow certain people to see the
bank details.
…
…
…
… [2]
(b) The database contains the following tables that store data about suppliers and stock.
SUPPLIER(SupId, SupName, SupAddress, SupPhone, SupContactName)
STOCK(StockId, SupId, StockName, StockImage, NumberInStock)
(i)
Write Data Manipulation Language (DML) statements to return the supplier name, phone
number and contact name, and the number of items in stock for the item with the stock
ID of D930.
…
…
…
…
…
… [4]
(ii)
The stock price needs to be included in the stock table.
$10.55 and $299.99 are two examples of stock prices.
Write Data Definition Language (DDL) statements to insert the attribute StockPrice
into the table STOCK.
…
…
…
… [2]
(c) Three examples of items stored in the data dictionary of a relational database are:
Item
Purpose
Field name
to store the names of fields so they cannot be repeated in a table
Primary key
to uniquely identify each record in a table
Validation rule
to ensure that data entered is sensible
Identify three other examples of items stored in a data dictionary and give the purpose of
each.
Item 1 …
Purpose …
…
…
Item 2 …
Purpose …
Question text
2
A veterinary surgery cares for sick animals. The surgery has a file-based database that stores
data about the pets, their owners, and appointments made with the surgery.
The surgery wants to upgrade to a relational database.
(a) Explain the reasons why the surgery should upgrade their database.
…
…
…
…
…
…
…
… [4]
(b) The design for the surgery database, SURGERY, is:
PET(PetID, OwnerFirstName, OwnerLastName, PetName, PetBreed,
PetDateOfBirth, TelephoneNumber)
APPOINTMENT(AppointmentID, Date, Time, StaffID, PetID)
(i)
Give one reason why the database design for SURGERY is not in Third Normal Form
(3NF).
…
… [1]
(ii)
The database needs to be normalised to 3NF. A pet may have more than one owner and
an owner may have more than one pet.
The appointment table does not need to change and has been repeated below.
Give the name and attributes of three additional tables in 3NF. Identify the primary
key(s) in each table.
APPOINTMENT(AppointmentID, Date, Time, StaffID, PetID)
Table 1 …
…
…
Table 2 …
…
…
Table 3 …
…
…
[4]
(c) Part of the table APPOINTMENT is shown. The veterinary surgery uses Data Manipulation
Language (DML) statements to search for appointments.
AppointmentID
Date
Time
StaffID
PetID
222010
02/02/2021
12:40
JK1
20CF
222011
02/02/2021
12:40
PP2
10DT
222012
02/02/2021
12:50
JK1
9RR
222013
02/02/2021
13:00
JK1
Question text
5
A teacher uses a relational database, RESULTS, to store data about her students and their test
results.
(a) Describe the benefits to the teacher of using a relational database instead of a file-based
approach.
…
…
…
…
…
…
…
… [4]
(b) The teacher sets up the RESULTS database using a Database Management System (DBMS).
(i)
Explain the ways in which the developer interface of a DBMS will help the teacher set up
the database.
…
…
…
… [2]
(ii)
The DBMS creates a data dictionary for the RESULTS database.
Identify three items that will be included in the data dictionary.
1 …
2 …
3 …
[3]
(c) The RESULTS database has the following structure:
STUDENT(StudentID, FirstName, LastName, Class, TargetGrade)
TEST(TestID, Topic, MaxMarks)
STUDENT_TEST(StudentID, TestID, Mark)
(i)
Complete the following table by giving one example of each database term from the
database RESULTS. Give both the field name and the corresponding table name.
Database term
Field name
Table name
Primary key
Foreign key
Attribute
[3]
(ii)
Tick (✓) one box to identify whether the database RESULTS is in 1NF, 2NF or 3NF.
Justify your choice.
1NF
2NF
3NF
Justification: …
…
…
… [3]
(iii)
Complete the Data Manipulation Language (DML) script to display the Student ID, mark
and maximum marks for all tests with the topic of ‘Programming’.
SELECT StudentID, Mark, ...
Question text
3
A hotel needs to record information about customers and their bookings.
(a) The hotel has two types of room: double and family. Each room has a unique room number.
The hotel stores information about the customers including their name, address and contact
details.
When a customer books a room, they give the start date and the number of nights they want
to stay. If a customer wants more than one room, each room must have a separate booking.
Each booking has an ID number.
The hotel creates a normalised, relational database to store the required information. There
are three tables:
•
CUSTOMER
•
ROOM
•
BOOKING
(i)
Complete the database design for the hotel by writing the attributes for each table.
CUSTOMER( …
…
… )
ROOM( …
…
… )
BOOKING( …
…
… )
[3]
(ii)
Identify the primary key for each table that you designed in part (a)(i).
CUSTOMER …
ROOM …
BOOKING …
[2]
(iii)
Identify one foreign key in the tables that you designed in part (a)(i).
Table name …
Foreign key …
[1]
(b) The hotel wants to use a Database Management System (DBMS) to set up and manage the
database.
Describe, using examples, how the hotel can use the following DBMS tools:
Developer interface …
…
…
…
…
Query processor …
…
…
Question text
7
A movie theatre has a relational database that stores the movie schedule, and information about
the movies. The theatre has several screens that play movies at the same time.
The database has three tables to store information about the movies, the screens and the movie
schedule.
MOVIE(MovieID, Title, Length, Rating)
SCREEN(ScreenNumber, NumberSeats)
MOVIESCHEDULE(ScheduleID, MovieID, ScreenNumber, Time)
(a) Complete the entity-relationship (E-R) diagram to show the relationships between these
tables.
MOVIE
SCREEN
MOVIESCHEDULE
[2]
(b) Explain how primary and foreign keys are used to link the tables in the movie theatre
database.
…
…
…
…
…
…
… [4]
(c) The database needs to store the name of the company that produced each movie, for
example, Rocking Movies.
Write an SQL script to add the attribute ProductionCompany to the MOVIE table.
…
…
…
…
… [2]
(d) Write an SQL script to display the title and rating of all movies scheduled to play on screen
number 3.
…
…
…
…
…
…
…
…
…
Question text
3
A Local Area Network is used by staff in a hospital to access data stored in a Database Management
System (DBMS).
(a) Name two security measures to protect computer systems.
1 …
2 …
[2]
(b) A frequent task for staff is to key in new patient data from a paper document. The document
includes the patient’s personal ID number.
(i)
The Patient ID is a seven digit number. The database designer decides to use a check
digit to verify each foreign key value that a user keys in for a Patient ID.
When a user assigns a primary key value to a Patient ID, the DBMS adds a modulus-11
check digit as an eighth digit. The DBMS uses the weightings 6, 5, 4, 3, 2 and 1 for
calculating the check digit. It uses 6 as the multiplier for the most significant (leftmost)
digit.
Show the calculation of the check digit for the Patient ID with the first six digits 786531.
Complete Patient ID … [4]
(ii)
Name and describe two validation checks that the DBMS could carry out on each
primary key value that a user keys in for a Patient ID.
1
Validation check …
Description …
…
2
Validation check …
Description …
…
[4]
Question text
7
A clinic is staffed by several doctors. The clinic serves thousands of patients. Each day and at any
one time, there is only one doctor in the clinic available for appointments.
The clinic stores patient, doctor and appointment data in a relational database.
(a) (i)
Underline the primary key for each table in the following suggested table designs.
PATIENT(PatientID, PatientName, Address, Gender)
DOCTOR(DoctorID, Gender, Qualification)
APPOINTMENT(AppointmentDate, AppointmentTime, DoctorID, PatientID)
[2]
(ii)
Complete the following entity-relationship (E-R) diagram for this design.
[2]
(b) The doctors are concerned that many patients make appointments but do not attend them.
Describe the changes to the table designs that could be made to store this information.
…
… [2]
(c) The doctors are about to set up a new clinic in the neighbouring village, SITE-B.
The original location is identified as SITE-A.
A new table is designed to store the ID of the doctor who is able to work at each site.
DOCTOR-AVAILABILITY(DoctorID, Site)
Five entries stored in the table are:
DoctorID
Site
098
SITE-A
074
SITE-A
117
SITE-B
098
SITE-B
033
SITE-B
(i)
State what this data shows about the availability of the doctor with the ID of 098.
…
… [1]
(ii)
Opening a new clinic in the neighbouring village will not require any additional table for
storing appointments. It will need a change to the existing appointment table design.
Show the revised APPOINTMENT table.
APPOINTMENT( …
… ) [1]
(d) The doctor with the ID of 117 has recently been allocated a new DoctorID of 017.
(i)
Write an SQL script to update this doctor’s record in the database.
UPDATE …
SET …
WHERE …
[3]
(ii)
Describe why this update could cause problems with the existing data stored.
…
…
… [2]
(e) Write an SQL script to display the date and time of all appointments made by the patient with
the PatientID of 556.
…
…
… [3]
Permission to reproduce items where third-party
Question text
3
A Local Area Network is used by school staff who access data stored in a Database Management
System (DBMS).
(a) (i)
Explain the difference between security and privacy of data.
…
…
…
…
…
… [3]
(ii)
Give an example for this application where privacy of data is a key concern.
…
… [1]
(b) Name and describe two security measures the Network Manager has in place to protect the
security of the data held in the DBMS.
1 …
…
…
…
2 …
…
…
…
[4]
(c) A task for staff at the start of the school year is to key in new pupil data from a paper document.
The data is entered to a screen form and includes the data verification of some fields.
Describe what is meant by verification.
…
…
…
… [2]
Question text
7
A company takes customer service for its clients very seriously.
The client
•
The client names are unique.
A visit
•
The company arranges a date for a visit to gather feedback from a client.
•
A visit to a client never takes more than one day.
•
Over time, the client receives many visits.
Staff (Interviewers)
•
One or more staff attend the visit.
•
If there is more than one staff member visiting, each performs a separate interview.
Interviews
•
Each interview is classified as either ‘general’ or by some specialism, for example, marketing,
customer service or sales.
•
A report is produced for each interview, InterviewText.
•
Each interview is conducted by a single staff member.
The client, visit, staff and interview data will be stored in a relational database.
(a) (i)
Underline the primary key for each table in the following suggested table designs.
STAFF(StaffID, StaffName, Department)
CLIENT(ClientName, Address, Town)
VISIT(ClientName, VisitDate)
INTERVIEW(ClientName, VisitDate, StaffID, SpecialistFocus, InterviewText)
[3]
(ii)
For each of the pairs of entities, A, B and C, draw the relationship between the two
entities.
A
VISIT
CLIENT
B
VISIT
INTERVIEW
C
INTERVIEW
STAFF
[3]
(b) The company decides to produce a visit report, VisitReportText, for each visit made.
This text will be produced from the one or more interview texts obtained at the visit.
State how one or more of the given table designs can be changed to add this attribute.
…
… [1]
(c) Client ABC Holdings are now trading under the name of Albright Holdings.
(i)
Write an SQL script to update this client’s record in the database.
UPDATE …
SET …
WHERE …
[3]
(ii)
Describe why this update could cause problems with the existing data stored.
…
…
… [2]
(d) Write an SQL script to display the Staff ID of each member of staff who performed an interview
when they visited New Age Toys on 13/10/2016.
…
…
… [3]
(e) At present, all interviews are performed in the UK. Many clients now operate in other countries
in Europe. The company wants to perform interviews with the client’s staff in other countries.
Not all interview staff are willing to travel outside of the UK.
State how one or more of the table designs should be revised to store this information.
…
…
Question text
1
(a) Five descriptions and seven relational database terms are shown below.
Draw a line to link each description to its correct database term.
Description
Database term
Any object, person or thing about which
it is possible to store data
Secondary key
Candidate key
Dataset organised in rows and columns;
the columns form the structure and the
rows form the content
Entity
Any attribute or combination of attributes
Foreign key
that can act as a unique key
Primary key
Attribute(s) in a table that link to the
primary key in another table to form a
relationship
Table
Tuple
Attribute or combination of attributes that
is used to uniquely identify a record
[5]
(b) Explain what is meant by referential integrity.
…
…
…
…
…
… [3]
Question text
9
A health club offers classes to its members. A member needs to book into each class in advance.
(a) The health club employs a programmer to update the class booking system. The programmer
has to decide how to store the records. The choice is between using a relational database or
a file-based approach.
Give three reasons why the programmer should use a relational database.
1 …
…
…
…
2 …
…
…
…
3 …
…
…
… [6]
(b) The programmer decides to use three tables: MEMBER, BOOKING and CLASS.
Complete the Entity-Relationship (E-R) diagram to show the relationships between these
tables.
MEMBER
CLASS
BOOKING
[2]
(c) The CLASS table has primary key ClassID and stores the following data:
ClassID
Description
StartDate
ClassTime NoOfSessions
AdultsOnly
DAY01
Yoga beginners
12/01/2016
11:00
5
TRUE
EVE02
Yoga beginners
12/01/2016
19:00
5
FALSE
DAY16
Circuits
30/06/2016
10:30
4
FALSE
Write an SQL script to create the CLASS table.
…
…
…
…
…
…
…
…
…
…