ROUND() in MySQL — How It Works
What the MySQL ROUND() function does, with an example.
Published October 21, 2026
ROUND(x, d) rounds a number to d decimal places; negative d rounds to tens, hundreds and so on.
How it works
Exact values (DECIMAL) round half away from zero; floating-point values may follow the C library.
Try it in MySQL
SELECT ROUND(3.14159, 2)
3.14
SELECT ROUND(1234, -2)
1200
SELECT ROUND(2.5)
3
Practical examples
Example 1
SELECT ROUND(3.14159, 2);
-- 3.14Example 2
SELECT ROUND(1234, -2);
-- 1200Example 3
SELECT ROUND(2.5);
-- 3Use it in a real query
SELECT id, ROUND(3.14159, 2) AS result
FROM your_table
LIMIT 10;Common mistakes
- Floating-point surprises (use DECIMAL).
- Confusing with TRUNCATE.
- Rounding before summing.
Key takeaways
- ROUND() in one line: ROUND(x, d) rounds a number to d decimal places; negative d rounds to tens, hundreds and so on.
- Try queries in a test database first.
- Check NULL handling and data types.
FAQ
Truncate instead?
TRUNCATE(x, d).
Does ROUND() work in other databases?
Most have an equivalent, but names and syntax vary between MySQL, PostgreSQL, SQL Server and SQLite.