Skip to main content
PRERELEASE CONTENT

ROW_NUMBER() (SQL)

A window function that assigns a unique sequential integer to each row within the same window frame, starting with one.

Synopsis

ROW_NUMBER()

Description

ROW_NUMBER assigns a unique sequential integer to each row, starting with one. If multiple rows contain the same value for the window function field, each row is assigned a unique sequential integer.

Examples

The following example assigns numbers in sequential order to each employee (within each department) based on their salary:

SELECT ROW_NUMBER() OVER (PARTITION BY Department ORDER BY Salary) FROM Company.Employee

See Also

Purpose of this instance: Draft documentation
DocReleaseID: SupplyChain2025.1
Content loaded from:
/staging/learning/iris-doc/2025.1.x/doc/supply-chain/en-us/src/
/staging/learning/iris-doc/2025.1.x/doc/cache/en-us/src/
/staging/learning/iris-doc/2025.1.x/doc/ensemble/en-us/src/
/staging/learning/iris-doc/2025.1.x/doc/iris/en-us/src/
/staging/learning/iris-doc/2025.1.x/doc/security/en-us/src/
Excluded items: PAGE_bi, PAGE_deployment, PAGE_interoperability, PAGE_release
FeedbackOpens in a new tab