SQL ROUND() Function
ROUND() Function
The ROUND() function is used to round a numeric field to the specified number of decimal places.
SQL ROUND() Syntax
SELECT ROUND(column_name, decimals) FROM TABLE_NAME;
| Parameter | Description | 
|---|---|
| column_name | Required. The field to round. | 
| decimals | Optional. Specifies the number of decimal places to return. | 
SQL ROUND() Example
ROUND(X): Returns the argument X, rounded to the nearest integer.
Example
mysql> SELECT ROUND(-1.23);
        -> -1
mysql> SELECT ROUND(-1.58);
        -> -2
mysql> SELECT ROUND(1.58);
        -> 2
ROUND(X,D): Returns the argument X, rounded to D decimal places. If D is 0, the result will have no decimal point or fractional part.
Example
mysql> SELECT ROUND(1.298, 1);
        -> 1.3
mysql> SELECT ROUND(1.298, 0);
        -> 1
Note: The ROUND return value is converted to a BIGINT!