Menghitung distribusi kumulatif - proporsi baris yang memiliki nilai kurang dari atau sama dengan baris saat ini.
DOUBLEDiperbarui: 13 Jun 2026CUME_DIST() OVER ([PARTITION BY col] ORDER BY col)Menentukan urutan untuk distribusi kumulatif
Opsional. Membagi hasil menjadi partisi
1 SELECT 2 name, 3 score, 4 CUME_DIST() OVER (ORDER BY score) as cume_dist, 5 ROUND(CUME_DIST() OVER (ORDER BY score) * 100, 1) as cumulative_pct 6 FROM students;
Menghitung berapa persen siswa dengan score <= saat ini.
| name | score | cume_dist | cumulative_pct |
|---|---|---|---|
| Ani | 70 | 0.25 | 25.0 |
| Budi | 80 | 0.50 | 50.0 |
| Citra | 90 | 0.75 | 75.0 |
| Deni | 95 | 1.00 | 100.0 |
1 SELECT 2 name, 3 score, 4 PERCENT_RANK() OVER (ORDER BY score) as prank, 5 CUME_DIST() OVER (ORDER BY score) as cdist 6 FROM students;
Membandingkan kedua fungsi untuk memahami perbedaannya.
| name | score | prank | cdist |
|---|---|---|---|
| Ani | 70 | 0.00 | 0.25 |
| Budi | 80 | 0.33 | 0.50 |
| Citra | 90 | 0.67 | 0.75 |
| Deni | 95 | 1.00 | 1.00 |
1 SELECT 2 month, 3 revenue, 4 CUME_DIST() OVER (ORDER BY revenue) as revenue_percentile 5 FROM monthly_revenue 6 ORDER BY revenue;
Menganalisis distribusi revenue bulanan.
Sudah paham CUME_DIST? Latih langsung di browser
Latihan interaktif, langsung di browser.