Window Functions
This section describes window functions, including their syntax, parameters, and usage examples.
Function List
Function |
Description |
---|---|
Divides data in a window partition sequentially into n groups. |
ntile
This function divides data in a window partition sequentially into n groups.
Syntax:
ntile(n) over ( [partition by partition_expression] [order by order_expression] )
Parameter |
Description |
Type |
Mandatory |
---|---|---|---|
n |
Number of groups. |
Integer |
Yes |
partition by partition_expression |
Partition expression for dividing data into partitions. |
Any |
Yes |
order by order_expression |
Window sorting. An order by clause is used to sort rows in a window partition. |
Any |
Yes |
Return value type: integer
Example: status,host,ntile(5) over (partition by status order by host) as n
Type |
Query Statement |
Returned Result |
---|---|---|
Scenario |
status,host,ntile(5) over (partition by status order by host) as n |
|
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.