Skip to main content
ROW NUMBER
Updated over 2 weeks ago

Description

The ROW_NUMBER() function assigns a unique sequential integer to rows within a partition of the dataset. This is useful for generating row numbers in ordered datasets.

Syntax

ROW_NUMBER()

Output

integer

Example

ROW_NUMBER() Over (Partition by Group Order by Value)

ID

Group

Value

ROW_NUMBER

1

A

10

1

2

A

20

3

3

A

15

2

4

B

30

1

5

B

40

2

Did this answer your question?