MySQL CEILING() Function

The CEILING() function in MySQL rounds a number *up* to the nearest integer. This means it always increases the number to the next whole number, discarding any fractional part.



CEILING(): Definition and Usage

CEILING() is handy when you need to work with whole numbers and want to ensure that any fractional part of a number is always rounded upwards. It's often used in situations where you need to perform calculations based on the next highest integer value.

Equivalent Function: CEIL()

The CEIL() function is a synonym for CEILING(); they both perform the same upward rounding operation.

Syntax

Syntax

CEILING(number)
      

Parameter Values

Parameter Description
number The number you want to round up. This is required and must be a numeric value.

Examples

Rounding Up a Decimal Number

This example demonstrates rounding the number 25.75 up to 26.

Syntax

SELECT CEILING(25.75);
      
Output

26
      

Rounding Up a Whole Number

If the input is already a whole number, CEILING() returns the same number.

Syntax

SELECT CEILING(25);
      
Output

25