[]
        
(Showing Draft Content)

DENSERANK

This function returns the rank of the current row within its partition without any gaps. Peers are ranked equally and are treated as ties.

To sort the rows, this function needs ORDERBY. The tied rows are identified by the combined values of the ORDERBY fields. If ORDERBY is not used, all rows are tied and return 1. It does not accept window frame definitions, such as FRAMEROWS and FRAMERANGE. It includes NULL values by default and treats them as the lowest possible values.

Syntax

DENSERANK()

Example

// WINDOW(DENSERANK(), ORDERBY([sold]))

city      |    sold     |    dense_rank
----------------------------------------------
Paris          100             1
Berlin         150             2
Moscow         200             3
Rome           200             3
London         300             4        

// WINDOW(DENSERANK(), ORDERBY([sold], [city]))

city      |    sold     |    dense_rank
------------------------------------------------
Paris          100             1
Berlin         150             2
Moscow         200             3
Rome           200             4
London         300             5