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 * FROM students WHERE house = Red; | AError: the clauses are in the wrong order. WHERE must come before ORDER BY. | |
| 2SELECT * FROM students ORDER BY points WHERE yearLevel = 7; | BSELECT firstName FROM students WHERE points >= 100; | |
| 3To find students with 100 points or more, use >= because > would leave out students on exactly 100. | CSELECT * FROM students WHERE yearLevel = 7 OR yearLevel = 8; | |
| 4To find students in year 7 or year 8, use OR because no student can be in both years at once. | DThe table name is missing: FROM and the table name (students) must follow the field list. | |
| 5SELECT firstName, points WHERE points > 50; | EError: the text value Red has no quotes, so SQL treats it as a field name. It should be 'Red'. | |
| 6SELECT * FROM products WHERE category = 'Tech' AND category = 'Sport'; | FAND is used when OR is needed: a product cannot be in two categories at once, so no records match. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
SQL error — A mistake in an SQL script, such as text without quotes, > instead of >=, AND instead of OR, clauses in the wrong order, a missing table after FROM or a missing semicolon.SELECT firstName
FROM students
WHERE points > 100;-- Students with 100 points or more
SELECT firstName FROM students
WHERE points >= 100;-- Products in either category
SELECT name FROM products
WHERE category = 'Tech' OR
category = 'Sport';SELECT firstName FROM students
WHERE house = 'Red'
ORDER BY points DESC;SELECT name FROM products
WHERE category = 'Tech'
ORDER BY price;