नोट
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप साइन इन करने या निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
Applies to:
Databricks SQL
Databricks Runtime
Divides the rows for each window partition into n buckets ranging from 1 to at most n.
Syntax
ntile([n])
Arguments
n: An optional INTEGER literal greater than 0.
Returns
An INTEGER.
The default for n is 1. If n is greater than the actual number or rows in the window
You must use the ORDER BY clause with this function.
If the order is non-unique, the result is non-deterministic.
Examples
> SELECT a, b, ntile(2) OVER (PARTITION BY a ORDER BY b) FROM VALUES ('A1', 2), ('A1', 1), ('A2', 3), ('A1', 1) tab(a, b);
A1 1 1
A1 1 1
A1 2 2
A2 3 1