6.12. SQL Select Order By
6.12.1. Order By
SELECT *
FROM astronauts
ORDER BY lastname;
6.12.2. Ascending
From smallest to biggest
ASC
SELECT *
FROM astronauts
ORDER BY lastname ASC;
6.12.3. Descending
From biggest to smallest
DESC
SELECT *
FROM astronauts
ORDER BY lastname DESC;
6.12.4. Multiple
When first criteria is the same
SELECT *
FROM astronauts
ORDER BY lastname ASC, firstname DESC;
6.12.5. Empty
NULLS FIRST
NULLS LAST
SELECT *
FROM astronauts
ORDER BY mission NULLS FIRST;
SELECT *
FROM astronauts
ORDER BY mission ASC NULLS LAST;