Description | The |
Syntax | NTILE( |
Output | integer |
Variables
number
: the number of buckets
Example
NTILE(3) Over (Partition by Group
Sort by ID
)
ID | Group | Value | NTILE |
1 | A | 10 | 1 |
2 | A | 20 | 2 |
3 | A | 15 | 3 |
4 | B | 30 | 1 |
5 | B | 40 | 3 |
Assigns a bucket number to each row in a partition
Description | The |
Syntax | NTILE( |
Output | integer |
number
: the number of buckets
NTILE(3) Over (Partition by Group
Sort by ID
)
ID | Group | Value | NTILE |
1 | A | 10 | 1 |
2 | A | 20 | 2 |
3 | A | 15 | 3 |
4 | B | 30 | 1 |
5 | B | 40 | 3 |