Worked solution from the Databases Paper 1 Theory Fundamentals booklet, Part 1 of 2.
Write one limitation, then explain how a relational database fixes it.
Limitation: data redundancy (the same data is stored in many places) [1]
Explanation: a relational database uses separate linked tables [1]
Each data item is stored only once, so duplication is reduced [1]
Other accepted limitation: data inconsistency — in a database, data changed in one place updates everywhere, and referential integrity stops linked data being entered differently. Another accepted one: program–data dependence — the DBMS manages changes to the structure, so programs do not need to be re-written.
REPAIR_PART is a linking table, so it is on the "many" side of both its relationships. Draw three lines, each with a crow's foot at the "many" end:
Line from REPAIR_PART to PART, with the crow's foot at REPAIR_PART (many-to-one) [1]
Line from REPAIR_PART to REPAIR, with the crow's foot at REPAIR_PART (many-to-one) [1]
Line from REPAIR to CUSTOMER, with the crow's foot at REPAIR (many-to-one) [1]
Both PartID and RepairNumber together make the primary key, as a part can be used in many repairs and a repair can use many parts.
CREATE TABLE REPAIR_PART(
PartID VARCHAR(20) NOT NULL,
RepairNumber VARCHAR(4) NOT NULL,
Quantity INT NOT NULL,
PRIMARY KEY (PartID, RepairNumber)
);CREATE TABLE REPAIR_PART with brackets, all statements inside them [1]
PartID and RepairNumber as VARCHAR (text) [1]
Quantity as an integer [1]
At least one suitable constraint, for example NOT NULL [1]
A composite primary key of PartID and RepairNumber [1]
SELECT SUM(AmountDue) FROM INVOICE WHERE SupplierID = "JK675" AND Paid = FALSE;
SELECT SUM of AmountDue [1]
FROM INVOICE with one correct condition [1]
The second correct condition joined with AND [1]
Write one definition for each term:
Referential integrity: every foreign key matches a primary key in the linked table, so the linked data between tables is consistent [1]
Candidate key: an attribute (or smallest set of attributes) that could be used as the primary key because no two records have the same value in it [1]
Tuple: one row (record) in a table [1]
▶ Topic lesson
A lesson on this topic · by Craig'n'Dave. Tap the picture to open it on YouTube.
Solutions follow the official Cambridge mark schemes; marks are shown in grey. Videos are from other YouTube channels. Paper codes read component / series / year: M/J = May/June, O/N = October/November. Past-paper questions © UCLES, reproduced for classroom practice.