Question bank › A-level › A-level Computer Science › Fundamentals of databases

Data modelling, relational databases and normalisation

10 questions51 marksabout 60 min

Answer on paper first, then reveal the mark scheme one mark at a time.

1Core4 marks

A school database has two tables:

Student(StudentID, Name, FormID)
Form(FormID, Tutor)

(a) State the foreign key in the Student table. [1]

(b) Explain the purpose of a foreign key. [1]

(c) State the type of relationship between Form and Student. [1]

(d) Explain why Tutor is stored in Form rather than in Student. [1]

2Hard5 marks

A table in first normal form is: Orders(OrderID, ProductID, OrderDate, CustomerID, CustomerName, CustomerCity, ProductName, UnitPrice, Quantity).

The primary key is (OrderID, ProductID). The dependencies are:
OrderID → OrderDate, CustomerID
CustomerID → CustomerName, CustomerCity
ProductID → ProductName, UnitPrice
(OrderID, ProductID) → Quantity

(a) Explain why the table is not in second normal form. [1]

(b) Give a set of tables in third normal form. Write each table as TableName(attribute, attribute, …) and write (PK) after every attribute that is part of that table’s primary key. [4]

3Standard3 marks

The entity-relationship diagram shows part of a shop's database. A crow's foot at the end of a line shows the ‘many’ side of a relationship.

(a) Identify the relationship that is many-to-many. [1]

(b) Explain how this relationship is implemented in a relational database. [2]

CustomerOrderProduct
Stuck on Data modelling, relational databases and normalisation?

Get it sorted in a free 30-minute session

We work through your weakest questions on this topic on Zoom. I reply the same day.

4Core5 marks

A leisure centre stores its data in a relational database. One of its relations is:

Attendance(MemberID, ClassID, SessionDate, CheckInTime)

Each class (e.g. Spin, Pilates) runs on many different dates, and a member may attend the same class every week.

(a) Explain what is meant by a relational database. [1]

(b) Define the term attribute. [1]

(c) State what is meant by a composite primary key. [1]

(d) Explain why the pair (MemberID, ClassID) would not be a suitable primary key for Attendance, and state a suitable primary key. [2]

5Standard5 marks

A vet clinic is designing a database. The following facts apply:

  • An owner can register many pets, but each pet is registered to exactly one owner.
  • A pet can have many appointments; each appointment is for one pet.
  • Each appointment is with one vet; a vet has many appointments.

(a) Draw an entity-relationship diagram to show the relationships between the entities Owner, Pet, Appointment and Vet. [3]

(b) Each appointment is given a unique appointment number and has a date and a time. Pets are identified by a PetID and vets by a VetID.

Write an entity description for the Appointment entity, in the form Entity(Attribute1, Attribute2, …). Underline the entity identifier. [2]

6Standard5 marks

A music school stores all of its lesson data in a single table, Lesson, with primary key LessonID. Some of the data is shown.

LessonIDPupilNameInstrumentTeacherIDTeacherNameTeacherPhoneDay
L01Ava BrennanViolinT4Mr Okafor07700 900412Mon
L02Sami HaddadCelloT4Mr Okafor07700 900412Tue
L03Lily ChenFluteT7Ms Novak07700 900188Mon
L04Ravi PatelViolinT4Mr Okafor07700 900412Thu
L05Erin WalshPianoT9Mrs Dlamini07700 900537Wed

(a) Mr Okafor changes his phone number. Using the data, describe the problem this causes for the school’s database. [2]

(b) The lesson L03 is cancelled and its record is deleted. Describe the problem this causes. [1]

(c) The school takes on a new teacher who has not yet been given any pupils. Explain why the new teacher’s details cannot be stored in this table. [1]

(d) The table is in second normal form but not third normal form. Identify the dependency that prevents it being in third normal form. [1]

7Standard6 marks

Three relations from an airline’s database are shown with their primary keys underlined and the functional dependencies that apply.

R1: FlightLeg(FlightNo, LegDate, AircraftReg, PilotID)
   (FlightNo, LegDate) → AircraftReg, PilotID

R2: Seat(AircraftReg, SeatNo, SeatClass, AircraftModel)
   (AircraftReg, SeatNo) → SeatClass
   AircraftReg → AircraftModel

R3: Pilot(PilotID, PilotName, BaseAirportCode, BaseAirportName)
   PilotID → PilotName, BaseAirportCode
   BaseAirportCode → BaseAirportName

All three relations are in at least first normal form. For each relation, state the highest normal form (1NF, 2NF or 3NF) that it is in and justify your answer. [6]

8Hard7 marks

A county athletics meeting records athletes’ entries on a single form. The data, in unnormalised form, is shown. Each athlete belongs to one club and may enter several events; for each event entered the athlete is given a heat and a lane.

AthleteIDAthleteNameClubCodeClubNameEventCodeEventNameHeatLaneNo
A101Maya OseiHRCHarbour Road AC100M
200M
100 metres
200 metres
2
1
4
6
A102Tom ReyesVACValley AC100M100 metres13
A103Priya NairHRCHarbour Road AC200M
800M
200 metres
800 metres
2
1
5
2

The functional dependencies are:
AthleteID → AthleteName, ClubCode
ClubCode → ClubName
EventCode → EventName
(AthleteID, EventCode) → Heat, LaneNo

(a) Explain why the data is not in first normal form. [1]

(b) The data is put into first normal form as a single relation with one row per athlete per event. State the primary key of this relation. [1]

(c) Normalise the data to third normal form. Write each relation in the form TableName(Key, Attribute, …), underlining the primary key of each. [5]

9Hard5 marks

A cinema records which seat is booked at each screening in a table, SeatBooking. One booking (BookingRef) can be for several seats at one screening. Some of the data is shown.

ScreeningIDSeatNoBookingRefCustomerEmailFilmTitleScreenNo
S301F7B9001[email protected]The Quiet Tide2
S301F8B9001[email protected]The Quiet Tide2
S301G7B9002[email protected]The Quiet Tide2
S305F7B9003[email protected]Lanterns4
S305F8B9003[email protected]Lanterns4

(a) Using the data, explain why SeatNo on its own is not a suitable primary key. [1]

(b) Using the data, explain why BookingRef on its own is not a suitable primary key. [1]

(c) State a suitable primary key for SeatBooking. [1]

(d) The primary key chosen for SeatBooking is (ScreeningID, SeatNo). The table is not in second normal form. Identify a partial dependency in the table. [1]

(e) After the table is converted to second normal form, one dependency would still prevent it from being in third normal form. Identify this dependency. [1]

10Stretch6 marks

An engineering consultancy is designing a database. The entity-relationship diagram shows part of the design. A crow’s foot shows the ‘many’ end of a relationship.

  • Every employee has at most one line manager, who is also an employee. A manager can manage many employees.
  • An employee can work on many projects and a project has many employees.
  • The company records the total number of hours (HoursLogged) each employee has worked on each project.

Other attributes are EmployeeID, EmployeeName, ProjectCode and ProjectTitle.

(a) Explain how the manages relationship would be implemented in a relational database. [2]

(b) Write entity descriptions, in third normal form, for a set of relations that implements the whole design. Underline the identifier of each entity. [3]

(c) Explain why HoursLogged cannot be stored as an attribute of the Project relation. [1]

EmployeeProjectworks onmanagesmanagermanaged

Stuck on this topic?

Book a free 30-minute session on WhatsApp and we'll find exactly which step is costing you the marks. Or build a timed paper on it.

Free 30-minute session