What does NTILE do and where is it used?

SQL window functions · Experienced

Model answer

NTILE(n) divides ordered rows into n roughly equal buckets (for example quartiles or percentiles) and returns the bucket number. It is used for segmenting customers into groups by spend.

Learn this topic

Window Functions: ROW_NUMBER, RANK and Running Totals in the course SQL for Beginners: Learn Databases Step by Step.

Sign in to add your own answer.

More questions