In this PostgreSQL post explains how to use the PostgreSQL ceiling function with syntax and examples.
The PostgreSQL ceiling function returns the smallest integer value that is greater than or equal to a number.
The syntax for the ceiling function in PostgreSQL is:
ceiling( number )
The value used to find the smallest integer value.
The ceiling function can be used in the following versions of PostgreSQL:
Let's look at some PostgreSQL ceiling function examples and explore how to use the ceiling function in PostgreSQL.
For example:
postgres=# SELECT ceiling(32.65);
ceiling
---------
33
(1 row)
postgres=# SELECT ceiling(32.1);
ceiling
---------
33
(1 row)
postgres=# SELECT ceiling(32);
ceiling
---------
32
(1 row)
postgres=# SELECT ceiling(-32.65);
ceiling
---------
-32
(1 row)
postgres=# SELECT ceiling(-32.1);
ceiling
---------
-32
(1 row)
postgres=# SELECT ceiling(-32);
ceiling
---------
-32
(1 row)