Section 24.4.3 ORDER BY Clause
• A query’s result can be sorted with the ORDER BY
clause (p. 1055). The simplest form of an ORDER BY
clause is
SELECT columnName1, columnName2, ... FROM tableName ORDER BY column ASCSELECT columnName1, columnName2, ... FROM tableName ORDER BY column DESC
where ASC
specifies ascending order, DESC
specifies descending order and column specifies the column on which the sort is based. The default sorting order is ascending, so ASC
is optional.
• Multiple columns can be used for ordering purposes with an ORDER BY
clause of the form
ORDER BY
column1 sortingOrder, column2 sortingOrder, ...
• The WHERE
and ORDER BY
clauses can be combined in one query. If used, ...
Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.