SQL ROUND
Round a number to a given number of decimal places.
Syntax
ROUND(number, decimals)
With no second argument it rounds to a whole number.
Example
Query (on the shop database used in the SQL course)
SELECT name, price, ROUND(price / 3, 2) AS three_payments FROM products LIMIT 4;
Result
| name | price | three_payments |
|---|---|---|
| Wireless mouse | 29.0 | 9.67 |
| Mechanical keyboard | 119.0 | 39.67 |
| USB-C hub | 49.0 | 16.33 |
| 27-inch monitor | 329.0 | 109.67 |
4 rows
Related
Learn it step by step in the free lesson Functions: Text, Numbers, Dates & CASE, with exercises that check your queries.