Problem Statement
What does NTILE(4) OVER (...) compute?
Explanation
NTILE splits the ordered rows into the requested number of buckets and labels each row with its bucket number. With 4, you get quartiles by row count.
It is handy for top-x percent tagging and A B testing splits.
Code Solution
SolutionRead Only
NTILE(4) OVER (PARTITION BY country ORDER BY revenue DESC) AS quartile
