Assigns a rank to each row within a partition based on the values in the specified column. When there are ties, the same rank is assigned and the next rank is skipped, leaving gaps in the sequence.
Category: window
Syntax:
Returns: Integer
Context Filtering: ✗ No
Parameters
| Name | Type | Required | Description |
|---|
column | column | ✓ Yes | The column to rank by |
Validation
- Minimum parameters: 1
- Maximum parameters: 1
Examples
Returns the rank of each row based on sales values. If two rows tie for rank 2, both get rank 2, and the next row gets rank 4.
Ranks rows by score values. Tied scores receive the same rank, with subsequent ranks showing gaps.
Result: 1, 2, 2, 4, 5, 6, ...
- DenseRank - Assigns rank without gaps
- PercentRank - Calculates relative rank as percentage
- RowNumber - Assigns sequential row numbers
- CumeDist - Calculates cumulative distribution
- Ntile - Divides rows into groups
Last modified on March 13, 2026