ORDER BY¶
The OREDER BY
clause sorts the result set of a query by one or more columns.
Syntax¶
OREDER BY <column_name> [ ASC | DESC ] [, ...]
column_name ::= identifier
Parameters¶
Parameter |
Description |
---|---|
|
The column by which to order the result set |
|
Order the result set in ascending order |
|
Order the result set in descending order |
Usage Notes¶
The ORDER BY
clause may be used in your main query. When used within a subquery, the CBO ignores it to improve performance.
Example¶
SELECT
employee_id,
employee_name,
salary
FROM
employees
ORDER BY
salary DESC;