Skip to content
masterclass Buddy

PostgreSQL · Function

dense_rank

dense_rank() gives the same rank to tied rows and increases the rank for each new peer group. Unlike rank(), it leaves no gaps.

Last updated

Syntax

dense_rank() → bigint

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • rank
  • row_number
  • percent_rank
  • cume_dist
  • OVER
  • PARTITION BY
  • ORDER BY

Source: PostgreSQL: Documentation: 18: 9.22. Window Functions. Checked 2026-11-03.