Cambridge AS Level Computer Science 9618 · 8.1 Database Concepts

Q7 · 9618/11/O/N/23 Q3

Worked solution from the Databases Paper 1 Theory Fundamentals booklet, Part 1 of 2.

Q79618/11/O/N/23original Q3Structured · 11 marks
Question 3 from 9618/11/O/N/23

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 IDEAAn E-R diagram shows 1:M links with the many end at the table holding the foreign key.
TOTAL 11 marks

Official mark scheme

Mark scheme for 9618/11/O/N/23 question 3
VIDEO
▶ Starts at Q3 (25:52)

Starts at Q3 (25:52) · by Pseudocode Pro. 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.