1.3 Sorting retrieval results (ORDER BY clause)
Use the ORDER BY clause to sort retrieval results in ascending or descending order. The specification format of the ORDER BY clause is as follows.
- Specification format
-
SELECT "column-name" FROM "table-name" WHERE search-condition ORDER BY "column-name" ASC
- ORDER BY "column-name" ASC:
-
Specify the column to be sorted on in column-name. Specify ASC to sort the retrieval results in ascending order, or DESC to sort them in descending order.
- Note
-
You can also specify a sort key that is not a column name in the ORDER BY clause. For details about the syntax of the ORDER BY clause, see 7.24 Sort specification list.