Ceiling Function In Sql in SQL
? CEILING() Function in SQL
The CEILING() function returns the smallest integer greater than or equal to a specified numeric value. It is essentially the same as the CEIL() function in many SQL databases.
? Syntax
CEILING(number)number: A numeric value (integer or decimal).Returns an integer value.
? Examples
1. Basic usage
SELECT CEILING(4.3);-- Returns 52. When the number is already an integer
SELECT CEILING(7);-- Returns 73. Negative numbers
SELECT CEILING(-3.7);-- Returns -3? Notes
CEILING()rounds up to the nearest integer.Supported by most SQL databases: MySQL, SQL Server, PostgreSQL, Oracle.
Equivalent to
CEIL()in databases that support that function.
Want to see the FLOOR() function for rounding down or examples combining these with other math functions?