Skip to main content
Skip to main content

dense_rank

Ranks the current row within its partition without gaps. In other words, if the value of any new row encountered is equal to the value of one of the previous rows then it will receive the next successive rank without any gaps in ranking.

The rank function provides the same behaviour, but with gaps in ranking.

Syntax

Alias: denseRank (case-sensitive)

For more detail on window function syntax see: Window Functions - Syntax.

Returned value

  • A number for the current row within its partition, without gaps in ranking. UInt64.

Example

The following example is based on the example provided in the video instructional Ranking window functions in ClickHouse.

Query:

Result: