sort-spec
Specifies a column to sort a query on
Format
{ ColIndex | [ ColQual . ] ColName } { ASC | DESC } { NULLS [FIRST | LAST] }
Remarks
Specifies a column to sort the result set on.
The column can be specified either by its 1-based index or its name.
The keywords ASC and DESC specify whether the sort should be ascending value (ASC) or descending value (DESC).If the ASC or DESC keywords are omitted, ASC is assumed.
By default NULL values are sorted at the low end of the resultset.
- When sorted in ascending order, NULL values will appear at the start of the resultset.
- When sorted in descending order, NULL values will appear at the end of the resultset.
The default NULL sorting behaviour can be overriden using NULLS FIRST or NULLS LAST.
- NULLS FIRST always places NULLs at the start of the resultset.
- NULLS LAST always places NULLs at the end of the resultset.