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