CEILING Function in SQL
The CEILING function takes a numeric value—typically a decimal or floating-point number—and returns the smallest integer that is greater than or equal to that value.
Note: This is different from rounding functions like ROUND, which might go up or down depending on the decimal, or FLOOR, which always rounds down. CEILING is all about going up, every time.
Syntax CEILING(number)
Example:
SQL
SELECT CEILING(7.14);
The output of the above code is 8.
Example:
SQL
SELECT CEILING(3.0)
The output of the above code is 3 (since it’s already an integer).
Example:
SQL
SELECT CEILING(-3.1)
The output of the above code returns -3 (more on negative numbers later).