ROW_NUMBER

A window function that numbers rows 1, 2, 3 in the window's order, giving tied rows different numbers.

In more detail

Because ties are broken arbitrarily, add a tie-breaker column to the ORDER BY so the numbering is repeatable. It is the usual way to pick the first or latest row in each group.

Related terms

Taught in

References