SQLite 3 reference · Math Functions

SQLite CEIL() Function

Return the smallest integer value not less than a number, rounding up: ceil(2.1) is 3. ceiling() is a synonym.

SQLite 3 Since 3.35.0

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

ceil(X)  |  ceiling(X)

Parameters

ParameterDescription
X A number (text that looks like a number is converted).

Return value

An integer for integer input, otherwise a floating-point number.

Examples

Round up
SELECT ceil(2.1) AS a, ceil(-2.1) AS b, ceil(5) AS c;

Output

a | b | c
3 | -2 | 5

Run this on your computer — see “Get Started” for setup.

Pages needed
SELECT count(*) AS products, ceil(count(*) / 5.0) AS pages_of_5
FROM products;

Output

products | pages_of_5
12 | 3

Run this on your computer — see “Get Started” for setup.

This is one of SQLite's built-in math functions, available since 3.35.0 when SQLite is compiled with SQLITE_ENABLE_MATH_FUNCTIONS (the default for the sqlite3 command-line tool and most language bindings). The in-browser SQLite on this site is built without them, so the examples show output from standard SQLite instead.

Version history

VersionChange
SQLite 3.35.0Added

In other languages

Was this page helpful?