The ORDER BY clause is an optional element of a SELECT statement. An ORDER BY clause allows you to specify the order in which rows appear in the ResultSet.
ORDER BY { column-Name | ColumnPosition | Expression } [ ASC | DESC ] [ , column-Name | ColumnPosition | Expression [ ASC | DESC ] ] *
You can sort the result set by a correlation name, if the correlation name is specified in the select list. For example, to return from the CITIES database all of the entries in the CITY_NAME and COUNTRY columns, where the COUNTRY column has the correlation name NATION, you specify this SELECT statement:
SELECT CITY_NAME, COUNTRY AS NATION FROM CITIES ORDER BY NATION
SELECT name, salary, bonus FROM employee ORDER BY salary+bonusIn this example, the salary and bonus columns are DECIMAL data types.
SELECT i, len FROM measures ORDER BY sin(i)