Skip to main content

NTILE (SQL)

A window function that splits the row within the specified window frame into num-groups number of groups that each have a roughly equal number of elements.

Synopsis

NTILE(num-groups)

Description

NTILE splits up the rows in the window frame into num-groups groups such that each group contains about the same number of elements. Each group is identified by a number, starting from one.

Arguments

num-groups

A number that specifies how many groups to split the rows into.

Examples

The following example splits up employees within each department into four groups based on their salaries:

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

See Also

Purpose of this instance: Draft documentation
DocReleaseID: IRISforHealth2025.1
Content loaded from:
/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/security/en-us/src/
/staging/learning/iris-doc/2025.1.x/doc/irishealth/en-us/src/
/staging/learning/iris-doc/2025.1.x/doc/healthcommon/en-us/src/
Excluded items: GCONV
FeedbackOpens in a new tab