w3resource

PostgreSQL CEILING() function

CEILING() function

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

Uses of CEILING() 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:

ceiling()

PostgreSQL Version: 9.3

Pictorial presentation of PostgreSQL CEILING() function

pictorial presentation of PostgreSQL CEILING() function

Example: PostgreSQL CEILING() function

Code:

SELECT CEILING(69.4) AS "Ceiling";

Sample Output:

 Ceiling
---------
      70
(1 row)

Example: PostgreSQL CEILING() function using negative value

Code:

SELECT CEILING(-69.8) AS "Ceiling";

Sample Output:

 Ceiling
---------
     -69
(1 row)

Previous: CEIL function
Next: COS function



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/PostgreSQL/ceiling-function.php