ROW_NUMBER returns a unique, sequential number for each row, starting with one, based on the order of the rows in the window partition.

No Parameters

Returns: decimal



SELECT name, regional_office, ROW_NUMBER() OVER ( PARTITION BY regional_office ORDER BY name)
  FROM employees


name regional_office row_number
Anna Snelling Central 1
Cecily Lampkin Central 2
Darcel Schlecht Central 3
Gladys Colclough Central 4
Jonathan Berthelot Central 5
Lajuana Vencill Central 6
Marty Freudenburg Central 7
Mei-Mei Johns Central 8
Moses Frase Central 9
Niesha Huffines Central 10
Versie Hillebrand Central 11
Carl Lin West 1
Carol Thompson West 2