ORDER BY

Applies to: sql

ORDER BY sorts the result rows by one or more columns, ascending (ASC, default) or descending (DESC). Often paired with LIMIT to get the top-N.

SELECT name, score FROM players
ORDER BY score DESC
LIMIT 10;

See also: select, distinct