> This page location: Math Functions > CEIL
> Full Neon documentation index: https://neon.com/docs/llms.txt

# PostgreSQL CEIL() Function

**Info:** The CEIL() function is part of standard PostgreSQL and works the same on any Postgres deployment, so you can use it wherever you run your database. If you're an enterprise looking for managed Postgres built for the AI era, [Lakebase](https://www.databricks.com/product/lakebase) delivers high performance, strong security, and native integration with the Lakehouse. If you're a developer or startup who needs to ship features and scale on demand, [Neon](https://neon.com) gives you the fastest path to production Postgres.

The PostgreSQL `CEIL()` function returns a number rounded up to the next whole number.

## Syntax

The following illustrates the syntax of the `CEIL()` function:

```sql
CEIL(numeric_expression)
```

## Arguments

The `CEIL()` function requires one argument:

**1) `numeric_expression`**

The `numeric_expression` is a number (or an expression that evaluates to a number) that is rounded up.

## Return Value

The `CEIL()` function returns a value whose data type is the same as the input argument.

## Examples

The following statement illustrates how to use the `CEIL()` function to round a number up to the nearest integer:

```sql
SELECT
    CEIL( 200.25 );
```

The result is:

```
 ceil
------
  201
(1 row)
```

Let's take the `customer` and `payment` tables in the [sample database](../postgresql-getting-started/postgresql-sample-database) for the demonstration.

![customer and payment tables](https://neon.com/postgresqltutorial/customer-and-payment-tables.png)The following example calculates the ceiling of amounts paid by customers for rentals:

```sql
SELECT
    first_name,
    last_name,
    CEIL(SUM( amount )) amt
FROM
    payment
INNER JOIN customer
        USING(customer_id)
GROUP BY
    customer_id
ORDER BY
    amt DESC;
```

The following picture illustrates the result:

![PostgreSQL CEIL function example](https://neon.com/postgresqltutorial/PostgreSQL-CEIL-function-example.png)

## Remarks

To round a number down to the nearest whole number, you use the [`FLOOR()`](https://neon.com/postgresql/math-functions/postgresql-floor) function.

In this tutorial, you have learned how to use the PostgreSQL `CEIL()` function to round a number up to the nearest integer, greater than or equal to the number.

---

## Related docs (Math Functions)

- [ABS](https://neon.com/postgresql/math-functions/abs)
- [CBRT](https://neon.com/postgresql/math-functions/cbrt)
- [DEGREES](https://neon.com/postgresql/math-functions/degrees)
- [DIV](https://neon.com/postgresql/math-functions/div)
- [EXP](https://neon.com/postgresql/math-functions/exp)
- [FACTORIAL](https://neon.com/postgresql/math-functions/factorial)
- [FLOOR](https://neon.com/postgresql/math-functions/floor)
- [GCD](https://neon.com/postgresql/math-functions/gcd)
- [LCM](https://neon.com/postgresql/math-functions/lcm)
- [LN](https://neon.com/postgresql/math-functions/ln)
- [LOG](https://neon.com/postgresql/math-functions/log)
- [MOD](https://neon.com/postgresql/math-functions/mod)
- [MIN_SCALE](https://neon.com/postgresql/math-functions/min_scale)
- [PI](https://neon.com/postgresql/math-functions/pi-function)
- [POWER](https://neon.com/postgresql/math-functions/power)
- [RADIANS](https://neon.com/postgresql/math-functions/radians)
- [RANDOM](https://neon.com/postgresql/math-functions/random)
- [ROUND](https://neon.com/postgresql/math-functions/round)
- [SCALE](https://neon.com/postgresql/math-functions/scale)
- [SIGN](https://neon.com/postgresql/math-functions/sign)
- [SQRT](https://neon.com/postgresql/math-functions/sqrt)
- [TRIM_SCALE](https://neon.com/postgresql/math-functions/trim_scale)
- [TRUNC](https://neon.com/postgresql/math-functions/trunc)
- [WIDTH_BUCKET](https://neon.com/postgresql/math-functions/width_bucket)
