Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1SELECT COUNT(*) FROM Member WHERE Town = 'Leeds'; | ACounts only the records where Town is Leeds, giving the number of members from Leeds. | |
| 2SELECT SUM(Fee) FROM Member WHERE Town = 'York'; | BAdds up the Fee values for York members only, ignoring members from other towns. | |
| 3Count the members who are from Leeds AND are aged over 16, using AND inside the WHERE clause of a COUNT. | CSELECT COUNT(*) FROM Member WHERE Town = 'Leeds' AND Age > 16; | |
| 4If no record matches the WHERE condition, COUNT returns zero, for example when no member lives in a town that is not in the table. | DThe WHERE clause is placed before FROM. FROM must come first, then WHERE: SELECT COUNT(*) FROM Member WHERE Town = 'Leeds'; | |
| 5SELECT COUNT(*) WHERE Town = 'Leeds' FROM Member; | EThe text value Leeds is missing quotes. It should be 'Leeds' because Town is a text field. | |
| 6SELECT SUM(Fee) FROM Member WHERE Town = Leeds; | FSELECT COUNT(*) FROM Member WHERE Town = 'Mars'; |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
SELECT COUNT(*) FROM Member WHERE Town = 'Leeds'; — WHERE filters the records first, then COUNT or SUM works only on the matching ones. This counts members from Leeds. If no record matches, COUNT gives 0.SELECT COUNT(*)
FROM Member
WHERE Town = 'Leeds';SELECT SUM(Fee)
FROM Member
WHERE Town = 'Leeds';SELECT COUNT(*)
FROM Member
WHERE Town = 'Leeds' AND Age > 18;SELECT COUNT(*)
FROM Member
WHERE Town = 'Leeds' OR Town = 'York';SELECT COUNT(*)
FROM Member
WHERE Town = 'Atlantis';