Question bank › GCSE › GCSE Computer Science › Relational databases and SQL

Relational databases: tables, keys & redundancy

10 questions44 marksabout 55 min

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

1Grade 1–33 marks

A gym stores data in a relational database with two tables, Members and Bookings.

Members

MemberIDFirstNameSurnameTownJoinYear
101AmiraKhanLeeds2021
102BenClarkeYork2023
103ChloeEvansLeeds2022
104DanielOkaforHull2020
105EllaMorganBradford2024
106FemiAdeyemiLeeds2023

Bookings

BookingIDMemberIDClassNameDay
B01101YogaMon
B02103SpinTue
B03102YogaWed
B04106PilatesMon
B05103YogaThu
B06105SpinFri

(a) Define the term primary key. [1]

(b) State the primary key of the Bookings table. [1]

(c) State the field in the Bookings table that is a foreign key. [1]

2Grade 4–54 marks

A gym used to store all its data in a single table, with the member's name and town repeated in every booking record.

(a) Explain what is meant by data redundancy and why it can lead to data inconsistency. [2]

(b) Explain how using two linked tables (a relational database) reduces this problem. [2]

3Grade 1–34 marks

A vet surgery stores details of the animals it treats in a database table called Pets.

Pets

PetIDPetNameSpeciesDOBOwnerSurname
1BiscuitDog2019-03-12Patel
2LunaCat2021-07-30Osei
3PipRabbit2022-01-05Hughes
4RexDog2017-11-21Patel
5MangoParrot2015-06-09Lee

(a) State the number of records in the Pets table. [1]

(b) State the number of fields in the Pets table. [1]

(c) Define the term database. [1]

(d) State the field in the Pets table that is the primary key. [1]

Stuck on Relational databases: tables, keys & redundancy?

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.

4Grade 4–54 marks

A library stores details of its books in a table called Books. Part of the table is shown.

Books

ISBNTitlePagesPriceOnLoan
0140449132The Odyssey3247.99TRUE
0451524934Nineteen Eighty-Four3288.99FALSE
0141439513Jane Eyre5326.49FALSE

(a) Give the most appropriate data type for each of the following fields. [3]

  • Pages
  • Price
  • OnLoan

(b) The ISBN field is stored using the string data type rather than integer. Explain why. [1]

5Grade 6–74 marks

A cinema records today's film screenings in a table called Screenings.

Screenings

ScreeningIDFilmTitleScreenStartTime
S01Star Voyage114:00
S02The Lost Map214:30
S03Star Voyage117:15
S04Garden of Secrets318:00
S05The Lost Map220:00
S06Star Voyage120:30

(a) State which field should be used as the primary key of the Screenings table. [1]

(b) Explain why FilmTitle could not be used as the primary key. [1]

(c) Every value in the StartTime field is currently different. Explain why StartTime would still be a poor choice of primary key. [2]

6Grade 4–54 marks

A school stores all of its instrumental music lessons in a single table. Each teacher always teaches in the same room.

Lessons

LessonIDStudentInstrumentTeacherTeacherRoom
L01Amara NwosuGuitarMr ByrneRoom 4
L02Tom EllisPianoMs ShahRoom 2
L03Amara NwosuPianoMs ShahRoom 2
L04Jess KaurGuitarMr ByrneRoom 7
L05Leo MarshDrumsMr ByrneRoom 4
L06Tom EllisGuitarMr ByrneRoom 4

(a) State the data inconsistency in the table. [1]

(b) Explain how storing the data in a single table has allowed this inconsistency to occur. [2]

(c) State the name of the problem where the same data is stored more than once in a database. [1]

7Grade 6–75 marks

A car-hire company stores customer details in a Customers table.

Customers

CustomerIDFirstNameSurnamePhoneLicenceNo
C101NadiaRahman07700 900111RAHMA905123NJ9AB
C102OwenPrice07700 900222PRICE811045OW9CD

The company needs a second table, Rentals, to record each time a car is hired. For each rental it must store the car's registration, the start date, the number of days and which customer hired the car. A customer may hire cars many times.

(a) Give the fields that the Rentals table should contain. State which field is the primary key and which field is the foreign key. [4]

(b) Explain why the customer's phone number should not be stored in the Rentals table. [1]

8Grade 4–54 marks

An online shop stores every order in one table.

Orders

OrderIDCustomerNamePostcodeItem
1001Priya NairME7 4QDHeadphones
1002Sam DoyleCT1 2LPMouse
1003Priya NairME7 4QDCable
1004Ewa NowakTN9 1SRKeyboard
1005Priya NairME7 4QDWebcam
1006Sam DoyleCT1 2LPMonitor
1007Priya NairME7 4QDCharger
1008Ewa NowakTN9 1SRSpeaker

(a) State how many times Priya Nair's postcode is stored in the Orders table. [1]

(b) The shop redesigns the database as a relational database with a Customers table and an Orders table. Calculate how many postcodes would now be stored in total for the orders shown. [1]

(c) Priya moves house. Explain one advantage of the relational design when her postcode is changed. [2]

9Grade 6–76 marks

A hospital uses a relational database with two tables. The diagram shows the structure of the tables and the link between them.

(a) State the name of the foreign key field and the table it is in. [1]

(b) State which table could contain several records with the same value of PatientID, and give a reason. [1]

(c) Explain two advantages of this relational design compared with storing all of the data in a single Appointments table that also holds the patient's name and date of birth. [4]

PatientsPatientIDFirstNameSurnameDateOfBirthAppointmentsApptIDApptDatePatientID *DoctorRoomKey: underlined = primary key, * = foreign key, 1 … M = one-to-many1M
10Grade 8–96 marks

A student is designing a database for a youth football league. Every player belongs to exactly one team, and each team has one coach and one home ground. The student's first design uses a single table.

Players

PlayerNameDateOfBirthPositionTeamNameCoachHomeGround
Kai Mensah2008-02-14StrikerRiverside U18D. HaleMill Lane
Zara Holt2009-09-03KeeperHillcrest U18S. AhmedPark Road
Kai Mensah2009-05-22DefenderHillcrest U18S. AhmedPark Road
Ben Osei2008-11-30MidfieldRiverside U18D. HaleMill Lane

The student says: "PlayerName can be the primary key because it identifies the player."

(a) Using the data in the table, explain why the student is wrong. [2]

(b) The student improves the design by using two tables, Players and Teams. Describe the fields each table should contain, stating the primary key of each table and how the two tables are linked. [4]

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