Concept Flow - ROUND, CEIL, FLOOR
Start with a number
ROUND
Return result
Start with a number, pick one of the functions ROUND, CEIL, or FLOOR, then get the rounded result accordingly.
SELECT ROUND(4.3), CEIL(4.3), FLOOR(4.7);
| Step | Function | Input | Operation | Result |
|---|---|---|---|---|
| 1 | ROUND | 4.3 | Round to nearest integer | 4 |
| 2 | CEIL | 4.3 | Round up to next integer | 5 |
| 3 | FLOOR | 4.7 | Round down to previous integer | 4 |
| 4 | END | All functions executed | Results: 4, 5, 4 |
| Variable | Start | After ROUND | After CEIL | After FLOOR | Final |
|---|---|---|---|---|---|
| Input Number | 4.3 / 4.3 / 4.7 | 4.3 | 4.3 | 4.7 | unchanged |
| ROUND Result | N/A | 4 | N/A | N/A | 4 |
| CEIL Result | N/A | N/A | 5 | N/A | 5 |
| FLOOR Result | N/A | N/A | N/A | 4 | 4 |
ROUND(number): rounds to nearest integer. CEIL(number): rounds up to next integer. FLOOR(number): rounds down to previous integer. Use these to control decimal rounding in SQL queries.