2210/22/M/J/24 question 10: worked solution (May/June 2024, paper 22)

Show as 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. Q18 2210/22/M/J/24 original Q10 Structured · 8 marks Worked solution (a) Write: ContractNumber [1] (b) Field Data type ContractNumber text / alphanumeric Months integer EndDate date/time Sport Boolean ContractNumber and Months correct [1] EndDate and Sport correct [1] (c) Statement 1: SUM adds up the Months values, so it finds the total number of months for all contracts [1] Statement 2: COUNT counts records, so it finds the number of contracts [1] Statement 2 only counts the contracts that are subscribed to News (News is true) [1] (d) SELECT ContractNumber FROM Contract WHERE News AND Sport; ContractNumber selected [1] News and Sport both in the WHERE part joined by AND (either order; News = TRUE is also fine) [1] KEY IDEA A unique text code makes the key, SUM adds, COUNT counts, and AND joins two conditions. TOTAL 8 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.