The SQL NTILE() is a window function that allows you to break a table into a specified number of approximately equal groups, or <bucket count>. For each row in a grouping, the NTILE() function assigns a bucket number representing the group to which the row belong starting at one.
The syntax of the NTILE() function is:
NTILE(<bucket count>) OVER (PARTITION BY <expression list> ORDER BY <sort parameter list>)
The <bucket count> is a literal positive integer or an expression that evaluates to a positive integer. Most of the time is an integer constant but using the option of an expression