ceil

Rounds a number toward positive infinity.

Syntax

ceil(<expr>)

Arguments

ArgumentTypeDescription
<expr>floatInput value.

Returns

Returns float. Returns NULL if the input is NULL.

Usage notes

For an int or uint column, cast the value to float before calling this function.

Examples

Convert call durations into started minutes: any partial minute counts as another minute.

VALUES ('call-17', 61.0), ('call-42', 120.0), ('call-63', 149.0)
SELECT $0 AS call_id, $1 AS duration_seconds
SELECT call_id, duration_seconds, ceil(duration_seconds / 60.0) AS started_minutes
+---------+------------------+-----------------+
| call_id | duration_seconds | started_minutes |
+---------+------------------+-----------------+
| call-17 | 61.0             | 2.0             |
| call-42 | 120.0            | 2.0             |
| call-63 | 149.0            | 3.0             |
+---------+------------------+-----------------+