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

Q9 · 2210/21/M/J/22 Q6

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

Q92210/21/M/J/22original Q6Structured · 5 marks
Question 6 from 2210/21/M/J/22

Worked solution

(a)

Count the field names in the table: GameID, GameName, AgeRestriction, GamePrice, NumberStock, OnOrder, DateLastOrdered, GameDescription.

Write: 8 [1]

(b)

Write: the primary key field must be unique (different) for each record. [1]

(c)

No stock means NumberStock = 0. On order means OnOrder = "Y". Sort by GameName, A to Z. Show only GameID, GameName and GamePrice.

GameIDGameNameGamePriceNumberStockOnOrder
TableGAMESGAMESGAMESGAMESGAMES
SortAscending
Show✓✓✓no tickno tick
Criteria=0="Y"
or

Correct fields and table name [1]

Correct sort (Ascending on GameName) and Show boxes [1]

Correct criteria: =0 and ="Y" [1]

KEY IDEAA primary key value must never repeat; two tests on one row both have to be true.
TOTAL 5 marks

Official mark scheme

Mark scheme for 2210/21/M/J/22 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.