Assign the rows of a column to a given number of ranks.
Ntile(ranks, field, direction)
ranks (required) Number of ranks. Must be an integer greater than 0.
field (required) The column used to order the table.
direction (optional) The direction to sort the input column. Enter is “asc” to sort ascending and “desc” to sort descending. Default sort is ascending.
NOTE: An equal number of rows will be given each Ntile rank. The Ntile ranks are assigned in order.
Ntile(4, [Population 2010])
An equal number of rows will be ranked 1, 2, 3 and 4 according to the size of their population. The lowest quartile of values in [Population 2010] will be ranked 1. The Highest quartile of values will be ranked 4.