Cambridge O Level Computer Science 2210 · 9.4 Structured query language (SQL)

Q6 · 2210/21/M/J/21 Q6

Worked solution from the Databases Paper 2 Algorithms, Programming and Logic booklet, Part 2 of 2.

Q62210/21/M/J/21original Q6Structured · 6 marks
Question 6 from 2210/21/M/J/21

Worked solution

(a)

Write: the data in the ID field is unique (not repeated) in every record. [1]

(b)

Count the rows: ABI to THR.

Write: 18 [1]

(c)

Genres with overdue books means Overdue is more than 0. Sort Overdue from largest to smallest. Show ID, GenreName and Overdue.

IDGenreNameOverdue
TableGENREGENREGENRE
SortDescending
Show✓✓✓
Criteria>0
or

The three correct fields, named correctly [1]

Correct table name and Show ticked in every column [1]

Correct sort: Descending on Overdue [1]

Correct criteria: >0 on Overdue [1]

KEY IDEAUse >0 to find records where something is not zero, and Descending to put the largest first.
TOTAL 6 marks

Official mark scheme

Mark scheme for 2210/21/M/J/21 question 6
VIDEO
▶ Topic lesson

A lesson on this topic · by Mr Bulmer's Learning Zone. 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.