CEILING()
Published May 26, 2023
Contribute to Docs
The SQL function CEILING()
is used to round up a numeric value to the next highest integer. It returns the next whole value that is greater than or equal to the input value.
Syntax
SELECT CEILING(value)FROM table_name;
value
- This is the value to be rounded up.
Example
The following data is given in a temperatures
table:
temp_id | raw_temp |
---|---|
1 | 30.25 |
2 | 9.95 |
3 | -5.7 |
The CEILING()
function can be used to round up the raw temperatures:
SELECT temp_id, CEILING(raw_temp) AS ceil_tempFROM temperatures;
The output will be:
temp_id | ceil_temp |
---|---|
1 | 31 |
2 | 10 |
3 | -5 |
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.