Cambridge AS Level Computer Science 9618 · 8.1 Database Concepts

Q11 · 9618/11/O/N/24 Q2

Worked solution from the Databases Paper 1 Theory Fundamentals booklet, Part 1 of 2.

Q119618/11/O/N/24original Q2Structured · 17 marks
Question 2 from 9618/11/O/N/24

Worked solution

(a)

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.

(b)(i)

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]

(b)(ii)

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]

(b)(iii)

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]

(c)

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]

KEY IDEAA linking table sits on the many side of both relationships, and its primary key is made from both foreign keys.
TOTAL 17 marks

Official mark scheme

Mark scheme for 9618/11/O/N/24 question 2
VIDEO
▶ 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.