← All languages
SQL keyword of the day
Random

CEIL

Round a number up to the nearest integer.

Description

The CEIL() function, also known as CEILING(), returns the smallest integer that is greater than or equal to the specified numeric expression. For example, CEIL(4.1) returns 5 and CEIL(-4.9) returns -4. CEIL() is useful for rounding up quantities, computing page counts from total items, and any scenario where fractional amounts must be rounded to the next whole number. It is part of the ANSI SQL standard and is supported across major database systems including PostgreSQL, MySQL, SQL Server, and Oracle.

Arguments

NameDescriptionOptional
numeric_expression A numeric value or column to round up to the nearest integer. No

Example

SELECT CEIL(4.3) AS rounded_up;
SELECT CEIL(total_items / 10.0) AS pages_needed FROM reports;