ORDER BY (Sorting the Results), Part 1 of 2
The SQL standard says that row order is irrelevant. The query results are therefore unordered and arbitrary.
You can use the ORDER BY clause to sort rows in the result table by a column or columns in ascending (ASC) order (lowest to highest) or descending (DESC) order (highest to lowest). See Collating Sequence.
SELECT [ALL | DISTINCT]
[* | column1[, column2, ...]]
FROM [table1 correlation, ...
| view1 correlation, ...]
WHERE condition1[, condition2, ...]
GROUP BY column1[, column2, ...]
HAVING condition1[, condition2, ...]
ORDER BY column1 [ASC | DESC][, column2 [ASC | DESC], ...];
> The ORDER BY clause is always the last clause in a SELECT statement when used.
> The columns in ORDER BY do not have to be listed in the SELECT clause.
> Specify ASC for ascending, or DESC for descending. If nothing is specified, it defaults to ASC.
> The GROUP BY and HAVING clauses will be discussed later. See GROUP BY and HAVING.