MySQL CEILING() Function
In MySQL, the CEILING()
function returns the smallest integer value greater not less than the specified number. The CEILING()
function is the same as the CEIL()
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.
CEILING()
Syntax
Here is the syntax of MySQL CEILING()
function:
CEILING(number)
Parameters
number
- Required. A number.
Return value
In MySQL, the CEILING()
function returns the smallest integer value greater not less than the specified number.
If the parameter number
is NULL
, the CEILING()
function will return NULL
.
CEILING()
Examples
SELECT
CEILING(123.123),
CEILING(123.789),
CEILING(123),
CEILING(-123.123),
CEILING(-123.789),
CEILING(-123),
CEILING(-100),
CEILING(NULL)\G
output
*************************** 1\. row ***************************
CEILING(123.123): 124
CEILING(123.789): 124
CEILING(123): 123
CEILING(-123.123): -123
CEILING(-123.789): -123
CEILING(-123): -123
CEILING(-100): -100
CEILING(NULL): NULL