ORDER BY
Sorting is part of the answer when sequence matters. The order you see in a table preview is not a guarantee.
Ascending and descending
ASC sorts from low to high and is the default. DESC reverses it. Numeric sorting uses the value; text sorting depends on collation.
Multiple sort keys
ORDER BY country, customer_name sorts countries first and names within each country. Each key has its own direction; DESC after the last column does not apply to all preceding columns.
Aliases and ties
An output alias can be used in ORDER BY in the supported practice engine. For reproducible output, add a unique key after your business sort, particularly when using a row limit.
NULL positions
The placement of NULLs differs across database systems and sort directions. If their position matters, make it explicit using supported NULLS FIRST/LAST syntax or an appropriate CASE expression.