↑↓ select ↵ open ⌫ change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Functions / Aggregate Functions

Computes the rank of the hypothetical row, with gaps; that is, the row number of the first row in its peer group.

Reading PG 18current·documented in 19 of 27 versions, 8.4 to 20

Signatures & examples

rank ( args ) WITHIN GROUP ( ORDER BY sorted_args ) → bigint
Computes the rank of the hypothetical row, with gaps; that is, the row number of the first row in its peer group.
rank () → bigint
Returns the rank of the current row, with gaps; that is, the row_number of the first row in its peer group.
Version history 3
  1. 12 → 13 changed
  2. 9.3 → 9.4 changed
  3. 8.3 → 8.4 added

Definition snapshot: b7bd9cda · English manual source