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



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://www.w3resource.com/PostgreSQL/ceil-function.php