CEIL Function - SQL


Overview


The CEIL function in SQL returns the smallest integer value that is greater than or equal to a given numeric expression. It is useful for rounding up to the nearest integer.

Example:

SELECT CEIL(5.2)

Syntax:

SELECT CEIL(numeric_expression)

numeric_expression is the numeric value you want to round up to the nearest integer.


Example: Hard-coded value


In this example, we are returning the closest integer value to 5.2 that is greater than or equal to it, the final output is 6.