A gym stores data in a relational database with two tables, Members and Bookings.
Members
| MemberID | FirstName | Surname | Town | JoinYear |
|---|---|---|---|---|
| 101 | Amira | Khan | Leeds | 2021 |
| 102 | Ben | Clarke | York | 2023 |
| 103 | Chloe | Evans | Leeds | 2022 |
| 104 | Daniel | Okafor | Hull | 2020 |
| 105 | Ella | Morgan | Bradford | 2024 |
| 106 | Femi | Adeyemi | Leeds | 2023 |
Bookings
| BookingID | MemberID | ClassName | Day |
|---|---|---|---|
| B01 | 101 | Yoga | Mon |
| B02 | 103 | Spin | Tue |
| B03 | 102 | Yoga | Wed |
| B04 | 106 | Pilates | Mon |
| B05 | 103 | Yoga | Thu |
| B06 | 105 | Spin | Fri |
(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]
- (a) A field that uniquely identifies each record in a table (allow column/attribute for field, row for record; allow 'a unique identifier for each record'; reject 'a field that is unique' with no reference to identifying records)(1)
- (b) BookingID(1)
- (c) MemberID (allow Bookings.MemberID)(1)
- Answer: (a) field that uniquely identifies each record (b) BookingID (c) MemberID
- Examiner tip: A foreign key is the primary key of ANOTHER table – look for a field that appears in both tables.