CEIL
Round a number up to the next whole number (a positive or negative integer).
CEIL(number)
CEILING
is a synonym for CEIL
.
For example:
premdb=# SELECT CEIL(2.5);
ceil
------
3
(1 row)
premdb=# SELECT CEIL(-1.2567);
ceil
------
-1
(1 row)
The following example finds the "ceiling" for the results of an AVG function.
premdb=# SELECT seasonid, AVG(SUBSTR(ftscore,3,1)::INT),
CEIL(AVG(SUBSTR(ftscore,3,1)::INT)) ceilgoals
FROM match GROUP BY seasonid ORDER BY 2;
seasonid | avg | ceilgoals
----------+---------------------------+-----------
15 | 0.99736842105263157894736 | 1
14 | 1.02368421052631578947368 | 2
13 | 1.06578947368421052631578 | 2
9 | 1.06578947368421052631578 | 2
7 | 1.06842105263157894736842 | 2
...
Parent topic:Mathematical Functions