Skip to main content
Window function
Returns a non-NULL rank 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: Positive integers starting at 1.
  • NULL behavior: Returns a non-NULL rank for every input row.
  • Empty input: An empty input produces no rows.

Properties

Usage notes

  • Rows with equal ORDER BY values receive the same rank. Ranking restarts within each PARTITION BY group.
  • Explicit window-frame clauses are not supported for this function.

Examples

Tied ordering values

Restart the calculation in each group

Last modified on October 15, 2026