Ceil Function In Sql in SQL
? CEIL() Function in SQL
The CEIL() function returns the smallest integer greater than or equal to a given number. It's also called CEILING() in some databases.
? Syntax
CEIL(number)or
CEILING(number)number: A numeric value (integer or decimal).Returns an integer.
? Examples
1. Basic usage
SELECT CEIL(4.2);-- Returns 52. When the number is already an integer
SELECT CEIL(7);-- Returns 73. Negative numbers
SELECT CEIL(-3.7);-- Returns -3? Notes
Useful for rounding up decimals to the nearest integer.
Available in most SQL databases: MySQL, PostgreSQL, SQL Server (
CEILING()), Oracle.
Want me to show you the opposite function like FLOOR()?