Worked solution from the Databases Paper 1 Theory Fundamentals booklet, Part 1 of 2.
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]
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]
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]
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]
▶ 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.