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 name, score FROM Students ORDER BY score DESC; | ALists student names from A to Z | |
| 2SELECT name FROM Students ORDER BY name; | BSELECT * FROM Students WHERE year = 10 ORDER BY age DESC; | |
| 3Sort the results by price from the lowest to the highest, using ASC to say so clearly | CSELECT * FROM Games ORDER BY price ASC; | |
| 4Show only Year 10 students, then sort those rows by age from oldest to youngest | DDESC goes after the field name, not before it. Fix: ORDER BY score DESC; | |
| 5SELECT * FROM Students ORDER BY WHERE year = 10; | EWHERE must come before ORDER BY, and ORDER BY needs a field name. Fix: WHERE year = 10 ORDER BY name; | |
| 6SELECT name FROM Students ORDER BY DESC score; | FLists students from the highest score to the lowest score |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
ORDER BY — Sorts the rows a SELECT query returns by a chosen field. It sorts A to Z or lowest to highest by default (ASC), or the reverse if you add DESC after the field name.SELECT name, score FROM students
ORDER BY score;SELECT name, score FROM students
ORDER BY score DESC;SELECT name FROM students
ORDER BY name;SELECT name, score FROM students
WHERE year = 10
ORDER BY score DESC;SELECT name, score FROM students
WHERE year = 9
ORDER BY score ASC;