Cambridge AS Level Computer Science 9618 · 8.1 Database Concepts

Q9 · 9618/11/M/J/24 Q6

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

Q99618/11/M/J/24original Q6Structured · 15 marks
Question 6 from 9618/11/M/J/24

Worked solution

(a)

Use three tables: users, quizzes and a joining table holding each score. Underline the primary keys when you write them.

USER(Username, Email, DateOfBirth, Rating)
QUIZ(QuizID, Date, Filename)
USER_QUIZ(Username, QuizID, Score)

USER table with Username as primary key [1]

...containing at least email, date of birth (or age) and rating [1]

QUIZ table with a primary key such as QuizID, date or filename [1]

...containing the other quiz fields [1]

A joining table with a suitable name and fields for user, quiz and score; primary key is Username and QuizID together [1]

...with foreign keys matching the primary keys of the other two tables [1]

(b)

Describe each feature, with an example (up to 2 marks each):

Data dictionary: data about the data in the database (metadata) [1]

...that describes the data to be stored, for example field names, data types or validation rules [1]

Logical schema: a platform-independent overview of the database, its conceptual design [1]

...used to plan the physical structure, for example an E-R diagram [1]

(c)(i)

Change EVENT with ALTER TABLE and add the foreign key.

ALTER TABLE EVENT
ADD FOREIGN KEY (PlayerID) REFERENCES PLAYER(PlayerID);

ALTER TABLE EVENT [1]

ADD FOREIGN KEY (PlayerID) REFERENCES PLAYER(PlayerID) [1]

(c)(ii)

Count the events for each player by grouping on PlayerID.

SELECT PlayerID, COUNT(EventID)
FROM EVENT
GROUP BY PlayerID;

SELECT PlayerID from EVENT [1]

COUNT(EventID) [1]

GROUP BY PlayerID [1]

KEY IDEAA 3NF design links tables with foreign keys; GROUP BY with COUNT gives a total per group.
TOTAL 15 marks

Official mark scheme

Mark scheme for 9618/11/M/J/24 question 6
VIDEO
▶ Starts at Q6 (1:13:07)

Starts at Q6 (1:13:07) · 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.