ORDER sorts the rows of a table by one or more expressions.
ORDER does not change the underlying schema.
ORDER does not impact the order of rows in data export.
ORDER BY <expr> (ASC | DESC) (NULLS FIRST | NULLS LAST)
ORDER syntax is as follows:
<expr>is usually a column name, such as ID, but it can be any expression, such as ID + 5
DESCcontrols direction. Default is ascending. Sort is lexicographic.
NULLS LASTcontrols null behavior. Default is
- A clause is
<expr (ASC|DESC) (NULLS FIRST | NULLS LAST)>. Multiple clauses can be written, but there must be at least one.
- Clauses are interpreted from left to right.
Updated almost 3 years ago