SQL ROUND() Function

ROUND () function

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;

parameters description
column_name Required. The field to be rounded.
decimals Required. Specifies the number of decimal places to be returned.

SQL ROUND () instance

ROUND (X): Returns a rounded integer of parameter X.

mysql> select ROUND(-1.23);
        -> -1
mysql> select ROUND(-1.58);
        -> -2
mysql> select ROUND(1.58);
        -> 2

ROUND(X,D): Returns the rounded number of parameter X with D decimal places. If D is 0, the result will have no decimal point or fractional part.

mysql> select ROUND(1.298, 1);
        -> 1.3
mysql> select ROUND(1.298, 0);
        -> 1

Note: ROUND return value is transformed into a BIGINT!