Membulatkan angka ke jumlah desimal tertentu. Default ke 0 desimal (bilangan bulat).
Sama dengan tipe inputDiperbarui: 13 Jun 2026ROUND(number [, decimal_places])Angka yang akan dibulatkan
Jumlah desimal (default: 0). Negatif untuk pembulatan ke puluhan/ratusan
Default: 0
1 SELECT 2 ROUND(3.14159) as default_round, 3 ROUND(3.14159, 2) as two_decimal, 4 ROUND(3.14159, 4) as four_decimal;
Pembulatan dengan berbagai presisi.
| default_round | two_decimal | four_decimal |
|---|---|---|
| 3 | 3.14 | 3.1416 |
1 SELECT 2 ROUND(1234, -1) as to_tens, 3 ROUND(1234, -2) as to_hundreds, 4 ROUND(1234, -3) as to_thousands;
Menggunakan decimal_places negatif.
| to_tens | to_hundreds | to_thousands |
|---|---|---|
| 1230 | 1200 | 1000 |
1 SELECT 2 category, 3 COUNT(*) as count, 4 ROUND(COUNT(*) * 100.0 / SUM(COUNT(*)) OVER (), 2) as percentage 5 FROM orders 6 GROUP BY category;
Menghitung persentase dengan 2 desimal.
| category | count | percentage |
|---|---|---|
| Electronics | 450 | 45.00 |
| Clothing | 350 | 35.00 |
| Books | 200 | 20.00 |
1 SELECT 2 product_name, 3 price, 4 ROUND(price, -2) as rounded_price 5 FROM products;
Membulatkan harga ke ratusan terdekat.
Sudah paham ROUND? Latih langsung di browser
Latihan interaktif, langsung di browser.