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, points FROM students WHERE house = 'Red' ORDER BY points DESC; | ASELECT name FROM products WHERE price > 5 OR stock = 0; | |
| 2SELECT COUNT(studentId) FROM students WHERE yearLevel = 8 AND house = 'Blue'; | BCounts the students who are in Year 8 and also in Blue house | |
| 3The task asks for the total of all the points in the table, so the missing function in the gap is SUM | CShows the first name and points of Red house students, with the highest points first | |
| 4The task asks for products costing more than 5 OR with no stock, so the missing keyword in the gap is OR | DThe sort direction is missing. ORDER BY defaults to ASC, so the cheapest comes first. DESC must be added after price. | |
| 5SELECT name, price FROM products ORDER BY price; -- task: most expensive first | ESELECT SUM(points) FROM students; | |
| 6SELECT firstName FROM students WHERE; -- task: students with more than 100 points | FThe condition after WHERE is missing. It needs a field, an operator and a value, such as points > 100. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
SELECT field FROM table WHERE condition; — Completing an SQL script: read the task, then fill the gap with the right field, WHERE condition, ASC or DESC, AND or OR, or SUM or COUNT so the query returns exactly what is asked.SELECT lastName
FROM students;SELECT firstName
FROM students
WHERE points > 100;SELECT firstName, points
FROM students
ORDER BY points DESC;SELECT firstName FROM students
WHERE yearLevel = 7 AND points > 100;SELECT SUM(points)
FROM students
WHERE house = 'Red';