9618/11/M/J/25 question 5: worked solution (May/June 2025, paper 11)
Show as plain textHide plain text
Cambridge AS Level Computer Science 9618 · 8.1 Database Concepts Worked solution from the Databases Paper 1 Theory Fundamentals booklet, Part 1 of 2. Q13 9618/11/M/J/25 original Q5 Structured · 13 marks Worked solution (a) Draw three lines, each with a crow's foot at the "many" end. Do not draw any extra lines. CUSTOMER to CUSTOMER_CARD_DATA : one-to-many, crow's foot at CUSTOMER_CARD_DATA [1] CUSTOMER to ORDER : one-to-many, crow's foot at ORDER [1] ORDER to ORDER_ITEM : one-to-many, crow's foot at ORDER_ITEM [1] (b) A candidate key is a field that could be the primary key because every value is different. Write: CardNumber [1] (c) Fill the table with any two of these (table and a foreign key in it): Table Foreign key ORDER_ITEM OrderID ORDER CustomerID CUSTOMER_CARD_DATA CustomerID One correct table with its foreign key [1] A second correct table with its foreign key [1] (d) Write three linked points: Each order can have many items , so the ORDER table would only be able to hold one item per order [1] The database would not be normalised / would not be in 1NF [1] ... because of repeated groups of attributes (Type, Height, Width and so on) in the ORDER table [1] (e) Join CUSTOMER to ORDER, keep only unpaid orders, add up the cost for each customer. SELECT CUSTOMER.CustomerID, CUSTOMER.Name, SUM(ORDER.TotalCost) AS TotalOwed FROM CUSTOMER INNER JOIN ORDER ON CUSTOMER.CustomerID = ORDER.CustomerID WHERE ORDER.Paid = FALSE GROUP BY CUSTOMER.CustomerID; Selecting the customer ID, name and SUM of TotalCost with a suitable title using AS [1] FROM with a suitable join of the two tables (ON or WHERE) [1] The condition Paid = FALSE [1] GROUP BY customer [1] KEY IDEA Draw crow's feet on the foreign-key side, and use GROUP BY with SUM to total values for each customer. TOTAL 13 marks Official mark scheme VIDEO ▶ Starts at Q5 (1:02:20) Starts at Q5 (1:02:20) · by Pseudocode Pro. Tap the picture to open it on YouTube.