Cambridge AS Level Computer Science 9618 · 8.3 Data Definition Language (DDL) and Data Manipulation Language (DML)

Q25 · 9618/12/M/J/25 Q5

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

Q259618/12/M/J/25original Q5Structured · 16 marks
Question 5 from 9618/12/M/J/25

Worked solution

(a)

Write any two points:

CHARACTER_ITEM is a linking table that removes the many-to-many relationship between CHARACTER and ITEM [1]

It lets each character have many items and each item be bought by many characters (it stores the items purchased for each character) [1]

(b)

Underline these attributes as the primary keys:

The three single keys: USER → Username, CHARACTER → CharacterID, ITEM → ItemName [1]

The composite key: CHARACTER_ITEM → CharacterID and ItemName together [1]

(c)(i)

Give two methods, each with its own explanation. Any two of these pairs score:

Method: access rights (permissions) [1]

Explanation: only users with the right permissions can read or edit the USER table [1]

Method: a password on the database or the USER table [1]

Explanation: users without the password cannot get at the data [1]

Other accepted pairs: encryption (without the key, the data cannot be understood); views (users are given a view that leaves out the USER table).

(c)(ii)

Write any two ways:

Validation on the data entered [1]

Enforcing referential integrity (including cascade update / delete) [1]

Other accepted ways: cascade update / delete, or making sure the database is normalised.

(d)(i)

ITEM purchases are in CHARACTER_ITEM, but the username is in CHARACTER, so the two must be joined.

SELECT COUNT(ItemName)
FROM CHARACTER_ITEM INNER JOIN CHARACTER
ON CHARACTER.CharacterID = CHARACTER_ITEM.CharacterID
WHERE CHARACTER.Username = "KAT123";

SELECT COUNT [1]

FROM the correct tables with a join [1]

WHERE condition for the username "KAT123" [1]

(d)(ii)

UPDATE CHARACTER
SET Level = 3, Money = 10000.00
WHERE CharacterID = "0002";

UPDATE CHARACTER [1]

SET Level and Money to the new values [1]

WHERE CharacterID = "0002" [1]

KEY IDEAA linking table splits a many-to-many relationship, and its primary key is made from both foreign keys.
TOTAL 16 marks

Official mark scheme

Mark scheme for 9618/12/M/J/25 question 5
VIDEO
▶ Whole paper

Video solution of the whole paper · by Virtual Help. 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.