9618/11/O/N/23 question 3: worked solution (October/November 2023, paper 11)

Show as 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. Q7 9618/11/O/N/23 original Q3 Structured · 11 marks Worked solution (a) Draw a line between each pair of linked tables, with a crow's foot on the many side: CUSTOMER 1 : M SHOP_ORDER (crow's foot at SHOP_ORDER) SUPPLIER 1 : M ITEM (crow's foot at ITEM) SHOP_ORDER 1 : M ORDER_ITEM (crow's foot at ORDER_ITEM) ITEM 1 : M ORDER_ITEM (crow's foot at ORDER_ITEM) CUSTOMER to SHOP_ORDER is 1:M [1] SUPPLIER to ITEM is 1:M [1] SHOP_ORDER to ORDER_ITEM is 1:M and ORDER_ITEM to ITEM is M:1 [1] (b) Write three advantages (any three): Reduced data redundancy [1] Improved data integrity and consistency [1] Allows views or improved privacy [1] Other accepted: program-data independence, complex queries can be run. (c)(i) CREATE DATABASE SHOP; CREATE DATABASE SHOP; [1] (c)(ii) Join ORDER_ITEM to SHOP_ORDER on OrderNo, pick the customer, then add up Quantity. SELECT SUM(Quantity) FROM ORDER_ITEM, SHOP_ORDER WHERE ORDER_ITEM.OrderNo = SHOP_ORDER.OrderNo AND SHOP_ORDER.CustomerID = 'HJ231'; SUM(Quantity) [1] FROM both tables [1] Join condition ORDER_ITEM.OrderNo = SHOP_ORDER.OrderNo [1] SHOP_ORDER.CustomerID = 'HJ231' [1] An INNER JOIN ... ON version scores the same. KEY IDEA An E-R diagram shows 1:M links with the many end at the table holding the foreign key. TOTAL 11 marks Official mark scheme VIDEO ▶ Starts at Q3 (25:52) Starts at Q3 (25:52) · by Pseudocode Pro. Tap the picture to open it on YouTube.