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 points > 100 ORDER BY points DESC; | AThe last clause of a full query. It sorts the rows that are left after WHERE has filtered them. | |
| 2ORDER BY points DESC; | BORDER BY is placed before WHERE. The clause order must be SELECT, FROM, WHERE, ORDER BY. | |
| 3WHERE comes straight after FROM and filters the rows before they are sorted. | CA semicolon is put after the SELECT line. The semicolon belongs only at the end of the whole statement. | |
| 4Keywords are written in capitals, one clause per line, and the semicolon goes only at the end of the whole statement. | DA full query with the clauses in the correct order: SELECT, FROM, WHERE, then ORDER BY, with one semicolon at the very end. | |
| 5SELECT firstName, points FROM students ORDER BY points WHERE points > 100; | EFROM students WHERE house = 'Red' | |
| 6SELECT name, price; FROM products WHERE price > 5 ORDER BY price; | FSELECT name, price FROM products ORDER BY price; |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
SELECT FROM WHERE ORDER BY — The order of clauses in a full SQL query: SELECT, FROM, WHERE, then ORDER BY. WHERE filters the rows first, then ORDER BY sorts the rows that are left.SELECT name, price FROM products
WHERE stock > 0
ORDER BY price;SELECT name, price FROM products
WHERE stock > 0
ORDER BY price;SELECT firstName FROM students
WHERE yearLevel = 8
ORDER BY points DESC;SELECT name, price FROM products
WHERE stock > 0
ORDER BY price;SELECT firstName, points FROM students
WHERE points > 100
ORDER BY points;