There are several ways to round decimal numbers, including ROUND, FLOOR, and CEILING. Its use is different depending on the need. For more details, let's look at the following explanation:
1. ROUND
If we want to round a number to a certain decimal length, we can use the ROUND function. Its use is as follows:
SELECT ROUND(2125.6235,0) as number
SELECT ROUND(2125.1275,0) as number
SELECT ROUND(2125.1275,0) as number
SELECT ROUND(2125.6235,2) as number
SELECT ROUND(2125.1275,2) as number
2. FLOOR
The FLOOR function returns the largest integer that is less or equal to the number to be rounded.
SELECT FLOOR(2125.6235) as number
SELECT FLOOR(2125.1235) as number
3. CEILING
The CEILING function returns the smallest integer greater than or equal to that number.
SELECT CEILING(2125.6235) as number
SELECT CEILING(2125.1235) as number
0 Comments