w3resource

PostgreSQL CEIL() function

CEIL() function

The PostgreSQL ceil() function is used to return the smallest integer greater than or equal to a given positive or negative decimal value.

Uses of CEIL() Function
  • Rounding Up Values: Ensures that any decimal number is rounded up to the nearest integer.

  • Financial Calculations: Useful in scenarios where rounding up to the nearest whole number is necessary, such as in pricing or budgeting.

  • Data Analysis: Applied in data processing tasks that require ceiling values for accurate aggregations.

  • Mathematical Computations: Used in mathematical functions and algorithms where ceiling values are required.

Syntax:

ceil()

PostgreSQL Version: 9.3

Pictorial presentation of PostgreSQL CEIL() function

pictorial presentation of PostgreSQL CEIL() function

Example: PostgreSQL CEIL() function

Code:

SELECT CEIL(53.7) AS "Ceil";

Sample Output:

 Ceil
------
   54
(1 row)

Example: PostgreSQL CEIL() function with negative value

Code:

SELECT CEIL(-53.7) AS "Ceil";

Sample Output:

 Ceil
------
  -53
(1 row)

Previous: CBRT function
Next: CEILING function



Follow us on Facebook and Twitter for latest update.