aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/docs/en/syntax/select/assume_order_by.md
blob: 61c9e2419636470709468a8217e3f4074e17a362 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# ASSUME ORDER BY

Checking that the `SELECT` result is sorted by the value in the specified column or multiple columns. The result of such a `SELECT` statement is treated as sorted, but without actually running a sort. Sort check is performed at the query execution stage.

As in case of `ORDER BY`, it supports setting the sort order using the keywords `ASC` (ascending order) and `DESC` (descending order). Expressions are not supported in `ASSUME ORDER BY`.

## Examples

```yql
SELECT key || "suffix" as key, -CAST(subkey as Int32) as subkey
FROM my_table
ASSUME ORDER BY key, subkey DESC;
```