MySQLWindow FunctionsNTILE
CUME_DIST

NTILEWindow Functions

LAG

Divides the partition into n equal buckets.

Syntax

NTILE(n) OVER (w)

Example

Enter values below to update the example in real time.

employee_id
sales_amount
quartile
sales_summary
-- 성과를 4분위로 구분
SELECT employee_id, sales_amount,
       NTILE(4) OVER (ORDER BY sales_amount DESC) AS quartile
FROM sales_summary;