SQL 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.
Understanding SQL ORDER BY in VCE Spreadsheets, SQL & Visualisation
What it does: ASC means ascending, so the lowest price comes first. It is the default, but writing it makes the order clear. WHERE filters the rows first, then ORDER BY sorts what is left. DESC puts the largest age (the oldest) first. Text sorts A to Z by default. Add DESC to get Z to A. DESC goes after the field name, at the end of the ORDER BY part.
Common mistakes: DESC must come after the field name, not before it. It should be ORDER BY score DESC; so the highest scores come first. The keyword is ORDER BY, not just ORDER. The line should be ORDER BY name ASC; to sort the names from A to Z.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 45–54) and word search (Modules 35–54).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
ORDER BYFill in the Blanks
Spot the Error
Student with a class code? Join your class →