MySQL CEIL() Function
In MySQL, the CEIL()
function returns the smallest integer value greater not less than the specified number. The CEIL()
function is the same as the CEILING()
function.
if you want to return the greatest integer value not greater than specified number, use the FLOOR()
function.
If you want to round a number to a specified number of decimal places, use the ROUND()
function.
If you want to truncate decimal places by the number of digits, use the TRUNCATE()
function.
CEIL()
Syntax
Here is the syntax of MySQL CEIL()
function:
CEIL(number)
Parameters
number
- Required. A number.
Return value
In MySQL, the CEIL()
function returns the smallest integer value greater not less than the specified number.
If the parameter number
is NULL
, the CEIL()
function will return NULL
.
CEIL()
Examples
SELECT
CEIL(123.123),
CEIL(123.789),
CEIL(123),
CEIL(-123.123),
CEIL(-123.789),
CEIL(-123),
CEIL(-100),
CEIL(NULL)\G
output
*************************** 1\. row ***************************
CEIL(123.123): 124
CEIL(123.789): 124
CEIL(123): 123
CEIL(-123.123): -123
CEIL(-123.789): -123
CEIL(-123): -123
CEIL(-100): -100
CEIL(NULL): NULL