clause
ORDER BY
Sorts results; add a unique tie breaker when a stable sequence matters. Example target: PostgreSQL 17 and SQLite (local fixture tested).
Formal Syntax & Structure
sql syntaxsql
ORDER BY expression [ASC | DESC]Working Example
Example Snippetsql
SELECT id FROM orders ORDER BY amount DESC, id;