Skip to content

Sorting with ORDER BY

Sorting the result

The rows come back in no particular order. Add ORDER BY to sort them by a column:

SELECT name, score FROM student ORDER BY score DESC;
  • ASC sorts ascending (smallest first) — this is the default.
  • DESC sorts descending (largest first).

Handout

Log in or create account

IGCSE, A-Level & AP