Sort

sort / order

Sorts the input rows by one or more columns. order is an alias for sort.

Spec

... | sort by <column> [asc | desc] [, ...]
... | order by <column> [asc | desc] [, ...]

Parameters

column - The column to sort by.
asc    - Ascending order (default).
desc   - Descending order.

Return Value

The input table sorted by the specified columns.

Example

datatable(Name:string, Score:int64)
[
    "Alice", 85,
    "Bob", 92,
    "Carol", 78
]
| sort by Score desc
NameScore
Bob92
Alice85
Carol78