IBM interview question

difference between row number, rank,dense rank

Interview Answer

Anonymous

26 Sept 2024

Row_number() assigns unique sequential number to each row, starting from 1 without regards duplicate. Rank() Assigns a rank to rows based on the specified order, with gaps in ranking for duplicate values, Rows with equal values get the same rank, but the next rank is skipped. Dense_rank() Assigns a rank like RANK(), but without any gaps for ties in values.Rows with equal values get the same rank, but the next rank is consecutive.