Window
MySQL
CUME_DIST
Menghitung distribusi kumulatif (0 sampai 1). Proporsi baris yang nilainya <= baris saat ini.
Tipe hasil:
DOUBLEDiperbarui: 7 Jan 2026Syntax
SQL
CUME_DIST() OVER ([PARTITION BY col] ORDER BY col)Parameter
ORDER BYcolumn(s)wajib
Kolom untuk menentukan urutan
PARTITION BYcolumn(s)opsional
Kolom untuk membagi data menjadi grup (opsional)
Contoh Penggunaan
Distribusi Kumulatif
SQL
1 SELECT name, score, 2 CUME_DIST() OVER (ORDER BY score) AS cume_dist 3 FROM students;
Proporsi siswa dengan skor <= baris ini.
Hasil
(cumulative distribution of scores)
Analisis Penjualan
SQL
1 SELECT product, revenue, 2 ROUND(CUME_DIST() OVER (ORDER BY revenue) * 100, 1) AS pct_below 3 FROM products;
Persentase produk dengan revenue <= ini.
Hasil
(products by revenue distribution)
Top Performers
SQL
1 SELECT * FROM ( 2 SELECT name, sales, 3 CUME_DIST() OVER (ORDER BY sales DESC) AS cd 4 FROM salespeople 5 ) t WHERE cd <= 0.1;
Top 10% salespeople.
Hasil
(top 10% performers)