Window function
Returns a non-NULL number for every input row.
Syntax
A window function keeps each input row and adds a result for that row. PARTITION BY groups rows with matching values; without it, all input rows form one group.
Window
Arguments
Takes no arguments.
Returns
- Type: BIGINT
- Possible values: 1 through the number of rows in the group.
- NULL behavior: Returns a non-NULL number for every input row.
- Empty input: An empty input produces no rows.
Properties
Usage notes
- Add a unique tie-breaker to ORDER BY when row identity must be stable.
- Explicit window-frame clauses are not supported for this function.
Examples
Unique ordering
Restart the calculation in each group
Last modified on October 15, 2026