ORDERBY

Defines the columns that determine the sort order within each of a window function’s partitions.

Syntax

ORDERBY ( <orderBy_columnName>[, <order>][, orderBy_columnName [, <order>]] [, …] )

Parameters

Term Definition
orderBy_columnName The name of an existing column to be used to sort the data within each of a window function’s partitions.
order (Optional) A value that specifies how to sort <orderBy_columnName> values, ascending or descending:
Value: DESC. Alternative value: 0(zero)/FALSE. Sorts in descending order of values of <orderBy_columnName>.
Value: ASC. Alternative value: 1/TRUE. Sorts in ascending order of values of <orderBy_columnName>. This is the default value if <order> is omitted.

Return value

This function does not return a value.

Remarks

This function can only be used within a window function expression.

Example

See OFFSET.

See also

INDEX
OFFSET
PARTITIONBY
WINDOW