Revision Library

Databases, SQL and Normalisation - Worksheets, Questions and Revision

12 original exam-style questions - 6 pages of questions with a full mark scheme - free printable PDF.

Download PDFJump to mark scheme (page 7)Read the revision guide
« Previous: Boolean Algebra, Logic Gates and Karnaugh MapsNext: Object-Oriented Programming »
Revision Library
revisionlibrary.co.uk
A-Level · Component 01: Computer Systems - Databases

A1.8 Databases, SQL and Normalisation

OCR H446 · Calculators not allowed · about 115 minutes
Total Marks
Name: _______________________________    Date: ____ / ____ / ______
Answer ALL questions. Show all your working.
1
This question is about the different types of key used in relational database tables.
(a)State what is meant by a primary key of a database table.(1)
(b)State what is meant by a foreign key.(1)
(c)A cinema stores ticket bookings in a table called Ticket. No single column is unique on its own, but the combination of ScreeningID and SeatNumber together always uniquely identifies one row. State the term for this type of key, and explain why two columns are needed rather than one.(2)
(d)A college's Student table has three columns that could each uniquely identify a student: StudentID, NationalInsuranceNumber and Email. StudentID is chosen as the primary key. State the term used for NationalInsuranceNumber and Email in this situation, and state one reason StudentID might be preferred as the primary key over NationalInsuranceNumber.(2)
(Total for Question 1 is 6 marks)
2
Ferngate Leisure Centre is replacing its paper-based booking system with a relational database. Management describe their requirements as follows:
- The centre employs several fitness instructors. Each instructor has one main speciality (e.g. yoga, spin, pilates) and runs one or more different fitness classes during the week.
- Each fitness class is run by exactly one instructor, on a fixed day and start time, and has a maximum number of places.
- Members join the centre and can book a place on any class. A member may book onto many different classes, and a class may have many members booked onto it, each on their own booking date, with a record kept of whether they actually attended.
- The centre needs to store each member's name, date of birth and the date they joined, and each instructor's name, speciality and contact number.
(a)Identify the four entities (tables) needed to model this system, and give a suitable name for each.(3)
(b)State, with a reason from the scenario, the relationship type (one-to-one, one-to-many or many-to-many) between Instructor and FitnessClass.(2)
(c)Explain why a linking entity (Booking) is needed to model the relationship between Member and FitnessClass, rather than a direct relationship between the two tables.(2)
(d)State a suitable primary key for each of the four entities you identified in part (a).(3)
(Total for Question 2 is 10 marks)
3
The analysis in Question 2 results in the following schema, which Ferngate Leisure Centre has now implemented (primary keys marked [PK], foreign keys marked [FK]):

Member(MemberID [PK], FirstName, LastName, DateOfBirth, JoinDate, MembershipType)
Instructor(InstructorID [PK], FirstName, LastName, Speciality, ContactNumber)
FitnessClass(ClassID [PK], ClassName, InstructorID [FK], DayOfWeek, StartTime, DurationMins, MaxCapacity)
Booking(BookingID [PK], MemberID [FK], ClassID [FK], BookingDate, Attended)

FitnessClass.InstructorID references Instructor.InstructorID. Booking.MemberID references Member.MemberID and Booking.ClassID references FitnessClass.ClassID. Attended holds the text 'Yes' or 'No'. Refer to this schema for every remaining question in this pack unless stated otherwise.

Write an SQL statement for each of the following.
(a)List the FirstName and LastName of every member whose MembershipType is 'Premium'.(2)
(b)List the ClassName and DayOfWeek of every fitness class, sorted alphabetically by ClassName.(2)
(c)Count how many bookings have been made for the class with ClassID 5.(2)
(d)Display each distinct MembershipType currently held by members, with no duplicates in the result.(2)
(e)List the LastName of every instructor whose Speciality contains the word 'Yoga' anywhere within it.(2)
(Total for Question 3 is 10 marks)
4
Refer to the Ferngate Leisure Centre schema given in Question 3. Write an SQL statement for each of the following.
(a)Insert a new row into the Member table for a new member with MemberID 214, first name Priya, last name Chandran, date of birth 14/03/2001, join date 01/07/2026, and membership type 'Standard'.(3)
(b)Increase the MaxCapacity of the class with ClassID 5 by 5 places.(2)
(c)Delete every booking record where Attended is 'No' and the BookingDate is before 01/01/2026.(3)
(Total for Question 4 is 8 marks)
5
Refer to the Ferngate Leisure Centre schema given in Question 3. The centre wants to add a new table, Payment, to record membership fee payments, with these columns: PaymentID (a whole number, and the primary key), MemberID (a whole number, a foreign key referencing Member), Amount (a decimal value), PaymentDate (a date) and Method (short text, e.g. 'Card' or 'Cash').
(a)Write the SQL statement to create the Payment table described above, including its primary key and foreign key constraints.(6)
(b)State why MemberID in the Payment table should be constrained as a foreign key rather than left as an ordinary, unconstrained column.(2)
(Total for Question 5 is 8 marks)
6
Refer to the Ferngate Leisure Centre schema given in Question 3.
(a)State what is meant by referential integrity in a relational database.(2)
(b)A member of staff tries to delete the row for InstructorID 3 from the Instructor table, but InstructorID 3 still appears as a foreign key value in three rows of the FitnessClass table. Explain what will happen if the DBMS enforces referential integrity with no cascade option set, and why this default behaviour is useful.(3)
(c)Explain, using this scenario, the difference in outcome if the foreign key constraint on FitnessClass.InstructorID were instead set to ON DELETE CASCADE.(3)
(Total for Question 6 is 8 marks)
7
Before adopting the schema in Question 3, Ferngate Leisure Centre kept class registers in a single flat table, ClassRegister, with no separate tables for classes, instructors or members. A sample of the data is shown below.

ClassRegister:
ClassIDClassNameInstructorIDInstructorNameInstructorSpecialityMemberIDMemberNameMemberPhoneBookingDateAttended
5Spin12Grace WhitfieldCycling88Callum Ashworth07700 90012303/02/2026Yes
5Spin12Grace WhitfieldCycling91Freya Doku07700 90045603/02/2026No
7Pilates12Grace WhitfieldCycling88Callum Ashworth07700 90012304/02/2026Yes

Using this table, describe an example of each type of anomaly named below.
(a)An insertion anomaly.(2)
(b)A deletion anomaly.(2)
(c)An update anomaly.(2)
(Total for Question 7 is 6 marks)
8
Refer to the ClassRegister table given in Question 7.
(a)State, with a reason, whether ClassRegister is in First Normal Form (1NF).(1)
(b)State the composite primary key of ClassRegister, and identify one partial dependency that prevents the table being in Second Normal Form (2NF).(3)
(c)Normalise ClassRegister to Second Normal Form (2NF) by removing the partial dependencies identified in part (b). State the resulting tables and the attributes (columns) in each.(4)
(d)State one transitive dependency remaining in your 2NF Class table from part (c), and normalise further to produce the resulting 3NF tables.(4)
(e)State one advantage of the normalised 3NF design from part (d) over the original flat ClassRegister table.(2)
(Total for Question 8 is 14 marks)
9
Refer to the Ferngate Leisure Centre schema given in Question 3. Write an SQL statement for each of the following.
(a)Using an INNER JOIN, list the FirstName and LastName of every member together with the ClassName of every class they have booked. Each member should appear once for every booking they have made.(4)
(b)Using a LEFT JOIN, list the FirstName and LastName of every member who has never made a booking.(4)
(c)State why an INNER JOIN would not be suitable for answering part (b).(2)
(Total for Question 9 is 10 marks)
10
Refer to the Ferngate Leisure Centre schema given in Question 3. Write an SQL statement for each of the following.
(a)Display the InstructorID and the number of classes each instructor runs, for instructors who run more than one class.(4)
(b)Using a subquery, display the ClassName of any class whose MaxCapacity is greater than the average MaxCapacity of all classes.(4)
(Total for Question 10 is 8 marks)
11
This question is about transaction processing in the Ferngate Leisure Centre database.
(a)State what each letter of the acronym ACID stands for, in the context of database transaction processing.(4)
(b)When a member books a class, the database must both insert a new row into Booking and update the count of places remaining for that class in FitnessClass, as a single transaction. Discuss why atomicity and isolation are both essential properties for this transaction, using this booking scenario to illustrate your answer.(4)
(Total for Question 11 is 8 marks)
12
This question is about how the Ferngate Leisure Centre database manages multiple users accessing it at the same time.
(a)State what is meant by record locking in a multi-user database system.(2)
(b)State one difference between pessimistic locking and optimistic (validation-based) concurrency control.(2)
(c)Two receptionists at different desks try, at almost the same moment, to book the last remaining place on the same fitness class for two different members. Discuss how the DBMS's concurrency control prevents this resulting in the class becoming overbooked, and explain what is meant by a deadlock and one method the DBMS could use to resolve one.(4)
(Total for Question 12 is 8 marks)
Mark scheme · A1.8 Databases, SQL and Normalisation

Question 1

Question 2

Question 3

Question 4

Question 5

Question 6

Question 7

Question 8

Question 9

Question 10

Question 11

Question 12

Mark your answers

This checks your answers in your browser, stores nothing on a server and needs no account.

Question 1

6 marks
Did your answer earn the marks?

Question 2

10 marks
Did your answer earn the marks?

Question 3

10 marks
Did your answer earn the marks?

Question 4

8 marks
Did your answer earn the marks?

Question 5

8 marks
Did your answer earn the marks?

Question 6

8 marks
Did your answer earn the marks?

Question 7

6 marks
Did your answer earn the marks?

Question 8

14 marks
Did your answer earn the marks?

Question 9

10 marks
Did your answer earn the marks?

Question 10

8 marks
Did your answer earn the marks?

Question 11

8 marks
Did your answer earn the marks?

Question 12

8 marks
Did your answer earn the marks?
Mark my answers