ROUND function is used to round the number of decimal places. ROUND function takes two parameters,
one is the number to round and second is the number of decimal it should round to.
You must provide second parameter otherwise it will round the number to 0 decimal.
Syntax is:-
ROUND(NUMERIC_FIELD,[ROUND_NUMBER_TO_DECIMAL]);
Example:-
SELECT ROUND(9.542,2) ROUND_TO;
--> 9.54
SELECT ROUND(6.6045,2) ROUND_TO;
--> 6.6
Note:- Above it have rounded to number to two decimal but since the 0 is second decimal so it will skip the same.
SELECT ROUND(98.5264,3) ROUND_TO;
--> 98.526
SELECT ROUND(99999.8574) ROUND_TO;
--> 99999
Read Also:- ROUND function in MySql
one is the number to round and second is the number of decimal it should round to.
You must provide second parameter otherwise it will round the number to 0 decimal.
Syntax is:-
ROUND(NUMERIC_FIELD,[ROUND_NUMBER_TO_DECIMAL]);
Example:-
SELECT ROUND(9.542,2) ROUND_TO;
--> 9.54
SELECT ROUND(6.6045,2) ROUND_TO;
--> 6.6
Note:- Above it have rounded to number to two decimal but since the 0 is second decimal so it will skip the same.
SELECT ROUND(98.5264,3) ROUND_TO;
--> 98.526
SELECT ROUND(99999.8574) ROUND_TO;
--> 99999
Read Also:- ROUND function in MySql
No comments:
Post a Comment