2210/23/O/N/24 question 11: worked solution (October/November 2024, paper 23)
Show as plain textHide plain text
Cambridge O Level Computer Science 2210 · 9.4 Structured query language (SQL) Worked solution from the Databases Paper 2 Algorithms, Programming and Logic booklet, Part 2 of 2. Q20 2210/23/O/N/24 original Q11 Structured · 7 marks Worked solution (a) Rows with WeightKg = 75 are MT06 (67.35) and MT12 (62.75). ORDER BY PricePerBag sorts from the lowest price, so MT12 comes first. MtNo Name MT12 Pebbles large MT06 Cobbles Row MT12 Pebbles large [1] Row MT06 Cobbles [1] Rows in the correct order [1] (b)(i) SELECT Name FROM BuildStock WHERE InStock = "No"; Correct SELECT and FROM clauses [1] Correct WHERE clause (WHERE NOT InStock, InStock = FALSE or NumberBags = 0 also score) [1] (ii) Use the InStock field in the WHERE clause [1] and check for false / No [1] Or use the NumberBags field in the WHERE clause and check for 0 . Only one of these two routes is needed, so it scores 2 marks. KEY IDEA ORDER BY sorts low to high by default, and out of stock can be found through InStock or NumberBags. TOTAL 7 marks Official mark scheme VIDEO ▶ Topic lesson A lesson on this topic · by Mr Bulmer's Learning Zone. Tap the picture to open it on YouTube.