SQLite Tutorial SQLite Advanced SQLite Database SQLite References

SQLite CEIL() Function



The SQLite CEIL() function returns the next highest integer value by rounding up the specified number, if necessary. In other words, it rounds the fraction UP of the given number.

The CEIL() function is a synonym for the CEILING() function.

Syntax

CEIL(x)

Parameters

x Required. Specify a number.

Return Value

Returns the next highest integer value by rounding UP the specified number, if necessary.

Example 1:

The example below shows the usage of CEIL() function.

SELECT CEIL(23);
Result: 23

SELECT CEIL(23.3);
Result: 24.0

SELECT CEIL(23.8);
Result: 24.0

SELECT CEIL(-23);
Result: -23

SELECT CEIL(-23.3);
Result: -23.0

SELECT CEIL(-23.8);
Result: -23.0

Example 2:

Consider a database table called Sample with the following records:

Datax
Data 1-10.75
Data 2-5.38
Data 30.98
Data 413.16
Data 548.13

The statement given below can be used to round the fraction UP for all records of column x.

SELECT *, CEIL(x) AS CEIL_Value FROM Sample;

This will produce the result as shown below:

DataxCEIL_Value
Data 1-10.75-10.0
Data 2-5.38-5.0
Data 30.981.0
Data 413.1614.0
Data 548.1349.0

❮ SQLite Functions