9618/12/O/N/25 question 4: worked solution (October/November 2025, paper 12)
Show as plain textHide plain text
Cambridge AS Level Computer Science 9618 · 8.3 Data Definition Language (DDL) and Data Manipulation Language (DML) Worked solution from the Databases Paper 1 Theory Fundamentals booklet, Part 2 of 2. Q27 9618/12/O/N/25 original Q4 Structured · 10 marks Worked solution (a) Say how many rows on each side can be linked, then name the keys. Write: the relationship between SHIP and CONTAINER is one-to-many (1:M). One ship can carry many containers. [1] Write: the primary key ShipID in the SHIP table is linked to the foreign key ShipID in the CONTAINER table. [1] (b) Use ALTER TABLE to change the table, ADD to add the field, and choose a sensible name and the DATE type. ALTER TABLE CONTAINER ADD InspectionDate DATE; ALTER TABLE statement used on CONTAINER [1] Extra field added with a suitable name and a suitable type (DATE) [1] (c) The ship name is in SHIP but the containers are in CONTAINER, so join the two tables on ShipID, then count. SELECT COUNT(ContainerID) FROM CONTAINER, SHIP WHERE CONTAINER.ShipID = SHIP.ShipID AND ShipName = "Caledonia"; SELECT COUNT used [1] Correct tables, CONTAINER and SHIP, after FROM [1] Tables joined on ShipID [1] Condition for the ship name Caledonia [1] An INNER JOIN ... ON CONTAINER.ShipID = SHIP.ShipID with WHERE ShipName = "Caledonia" also scores. (d) Write any two of these points, 1 mark each: It lets the user create, modify or delete tables (maintain the database), or set up and change relationships . [1] It lets the user create forms for data input (with tools such as drop-down boxes, buttons or menus), or design reports to show output neatly. [1] Other points that score: add a menu to choose different actions, or inspect the database contents and metadata by creating and running SQL queries . KEY IDEA A foreign key in the many side links to the primary key on the one side, and SQL joins tables on that matching key. TOTAL 10 marks Official mark scheme VIDEO ▶ Topic lesson A lesson on this topic · by Craig'n'Dave. Tap the picture to open it on YouTube.