NTILE, PERCENT_RANK, CUME_DIST

Published July 26, 2025 By Sai Sree Ram Gundepudi

NTILE, PERCENT_RANK, CUME_DIST

  • NTILE(n): Divides rows into n buckets.
  • PERCENT_RANK(): Shows relative rank (0 to 1).
  • CUME_DIST(): Shows cumulative distribution of value in partition.
SELECT employee_id, salary,
       NTILE(4) OVER (ORDER BY salary) AS quartile
FROM employees;

Was this solution helpful?

Your feedback helps improve our technical knowledge repository.

Share this article