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

Q8 · 2210/22/O/N/21 Q6

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

Q82210/22/O/N/21original Q6Structured · 6 marks
Question 6 from 2210/22/O/N/21

Worked solution

(a)(i)

A Boolean field holds only two values, such as yes or no.

Write: InStock [1]

(a)(ii)

Write: ProductID (it identifies each product, so it is unique). [1]

(b)

Show ProductID and ProductName. Sort by ProductID. Test Animal = "cat" and InStock = Yes on the same row.

ProductIDProductNameAnimalInStock
TableSTOCKSTOCKSTOCKSTOCK
SortAscending
Show✓✓no tickno tick
Criteria="cat"=Yes
or

Correct field names [1]

Correct table names, and Show ticked only for ProductID and ProductName [1]

Correct sort: Ascending on ProductID [1]

Correct criteria in both columns: ="cat" and =Yes [1]

KEY IDEAThe primary key is the unique field; Boolean fields hold only two values.
TOTAL 6 marks

Official mark scheme

Mark scheme for 2210/22/O/N/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.