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