9618/13/O/N/25 question 5: worked solution (October/November 2025, paper 13)

Show as 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. Q28 9618/13/O/N/25 original Q5 Structured · 16 marks Worked solution (a) COMPLAINT holds the keys of the other three tables (ProductID, CustomerID, StaffID) as foreign keys, so each of the other tables has a one-to-many link to COMPLAINT. Draw a line from CUSTOMER to COMPLAINT with the 'many' crow's foot end at COMPLAINT. [1] Draw a line from PRODUCT to COMPLAINT with the crow's foot at COMPLAINT. [1] Draw a line from STAFF to COMPLAINT with the crow's foot at COMPLAINT. [1] There is no line between CUSTOMER, PRODUCT and STAFF. (b) Use CREATE TABLE with brackets and commas, a type for every field, and StaffID as the primary key. Names and letters suit VARCHAR and CHAR, and Yes/No suits BOOLEAN. CREATE TABLE STAFF( StaffID INTEGER, StaffFirstName VARCHAR, StaffLastName VARCHAR, Department CHAR, RemoteWorker BOOLEAN, PRIMARY KEY (StaffID) ); CREATE TABLE with opening and closing brackets and commas between the fields [1] Suitable types for StaffFirstName, StaffLastName and Department [1] Suitable types for StaffID and RemoteWorker [1] Primary key correctly defined (StaffID) [1] Writing StaffID INTEGER NOT NULL PRIMARY KEY on the field line also scores. (c) Rating is in PRODUCT and ComplaintDetails is in COMPLAINT, so join the tables on ProductID. Write PRODUCT.ProductID because ProductID is in both tables. SELECT PRODUCT.ProductID, ProductName, ComplaintDetails FROM PRODUCT, COMPLAINT WHERE PRODUCT.ProductID = COMPLAINT.ProductID AND Rating <= 5 ORDER BY Rating DESC; SELECT with the three correct fields [1] FROM with the correct tables, PRODUCT and COMPLAINT [1] Tables joined correctly on ProductID [1] Correct condition for the rating (Rating <= 5) [1] Correct ORDER BY Rating DESC [1] An INNER JOIN ... ON PRODUCT.ProductID = COMPLAINT.ProductID also scores. (d) Give two methods. Each method gets one mark for the name and one mark for what it does. Write two like these: Authentication (passwords, biometrics, two-factor) can be set up [1] ... which stops unauthorised people getting at the customer data. [1] Access rights (privileges) can be set [1] ... so only people with the right permission can read or edit customer data. [1] Other methods that score the same way: regular backups (a second copy if data is lost or damaged), encryption (stolen data cannot be understood), and different views (not everyone sees the customer data). KEY IDEA The table holding foreign keys is the many side, and SQL joins use the matching key; DBMS security means controlling who can see data. TOTAL 16 marks Official mark scheme VIDEO ▶ Topic lesson A lesson on this topic · by Craig'n'Dave. Tap the picture to open it on YouTube.