Order
Overview
Order
allows the rows of a table to be sorted by one or more expressions. Order
does not change the underlying schema. Order
does not impact the order of rows in data export.
Template |
---|
ORDER BY (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 + 5ASC
/DESC
controls direction. Default is ascending. Sort is lexicographic.NULLS FIRST
/NULLS LAST
controls null behavior. Default isnulls last
.- 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 over 5 years ago