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 firstName FROM students WHERE house = 'Red' ORDER BY points DESC; | AKeeps only the Year 7 rows, then outputs a single number: how many rows passed the WHERE condition. | |
| 2SELECT COUNT(*) FROM students WHERE yearLevel = 7; | BAND needs both conditions to be true, but no student is in Year 7 and Year 8 at once. No row passes, so the count is 0. OR should be used to count both years. | |
| 3If no row passes the WHERE condition, the output shows the field headings but no records. | CWHERE is placed after ORDER BY. The clause order is wrong, so the query will not run. WHERE must come first to pick the rows before they are sorted. | |
| 4With OR, a row is kept if either condition is true. Rows are picked first, then the chosen fields are shown. | DSELECT firstName FROM students WHERE house = 'Red' OR yearLevel = 7; | |
| 5SELECT firstName FROM students ORDER BY points DESC WHERE house = 'Red'; | ESELECT firstName FROM students WHERE points > 500; | |
| 6SELECT COUNT(*) FROM students WHERE yearLevel = 7 AND yearLevel = 8; | FKeeps only the Red house rows, sorts them from highest points to lowest, then shows just the firstName column. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
WHERE, ORDER BY, SELECT — To find a query's output, first keep the rows that pass WHERE, then sort them with ORDER BY, then show only the SELECT fields or the SUM or COUNT result.SELECT firstName, points
FROM students
WHERE points > 100;SELECT firstName, points
FROM students
ORDER BY points DESC;SELECT firstName
FROM students
WHERE house = 'Red' AND points > 100;SELECT COUNT(*)
FROM students
WHERE house = 'Blue';SELECT firstName, points FROM students
WHERE house = 'Red'
ORDER BY points DESC;