Concept Flow - ROUND, CEIL, FLOOR
Start with a number
ROUND
Round to nearest
Return result
End
Start with a number, pick ROUND to round normally, CEIL to round up, or FLOOR to round down, then get the result.
SELECT ROUND(4.3), CEIL(4.3), FLOOR(4.3);
| 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.3 | Round down to previous integer | 4 |
| 4 | END | All functions executed | Query returns (4, 5, 4) |
| Variable | Start | After ROUND | After CEIL | After FLOOR | Final |
|---|---|---|---|---|---|
| number | 4.3 | 4.3 | 4.3 | 4.3 | 4.3 |
| ROUND_result | N/A | 4 | 4 | 4 | 4 |
| CEIL_result | N/A | N/A | 5 | 5 | 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 queries. Example: SELECT ROUND(4.3), CEIL(4.3), FLOOR(4.3);