Worked solution from the Databases Paper 1 Theory Fundamentals booklet, Part 2 of 2.
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]
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]
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.
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.
▶ 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.