PostgreSQL: ceiling Function
This PostgreSQL tutorial explains how to use the PostgreSQL ceiling function with syntax and examples.
Description
The PostgreSQL ceiling function returns the smallest integer value that is greater than or equal to a number.
Syntax
The syntax for the ceiling function in PostgreSQL is:
ceiling( number )
Parameters or Arguments
- number
- The value used to find the smallest integer value.
Note
Applies To
The ceiling function can be used in the following versions of PostgreSQL:
- PostgreSQL 9.4, PostgreSQL 9.3, PostgreSQL 9.2, PostgreSQL 9.1, PostgreSQL 9.0, PostgreSQL 8.4
Example
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)
Advertisements