SQL ROUND Function: Complete Guide with Examples

In SQL, you can use the ROUND() function to round numbers. The syntax for the ROUND() function is as follows:

ROUND(number, decimals)

In this case, ‘number’ represents the number that needs to be rounded, while ‘decimals’ indicates the number of decimal places to be retained. For example, to round a number to a whole integer, you can use the following statement:

SELECT ROUND(123.45);

To round a number to a specified number of decimal places, you can use the following statement:

SELECT ROUND(123.4567, 2);

Rounding 123.4567 to two decimal places will result in 123.46.

bannerAds