ORDER BY clause
The ORDER BY clause specifies the order of retrieved rows, using the keywords ASC (the default) and DESC for ascending and descending, respectively. For example, the following query retrieves a list of all parts listed in alphabetical order by part name:
SELECT * FROM PARTS ;
ORDER BY PART_NAME ASC
The next query retrieves all part information ordered in descending numeric order by part number:
SELECT * FROM PARTS ;
ORDER BY PART_NO DESC
Calculated fields can be ordered by correlation name or ordinal position. For example, the following query orders rows by FULL_NAME, a calculated field:
SELECT LAST_NAME || ', ' || FIRST_NAME AS FULL_NAME, PHONE ;
FROM CUSTOMER ;
ORDER BY FULL_NAME
Projection of all grouping or ordering columns is not required.