SQL CEILING()

nikolaspoczekaj's avatar
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.

  • Learn to analyze data with SQL and prepare for technical interviews.
    • Includes 9 Courses
    • With Certificate
    • Beginner Friendly.
      18 hours
  • In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.
    • Beginner Friendly.
      5 hours

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_temp
FROM temperatures;

The output will be:

temp_id ceil_temp
1 31
2 10
3 -5

All contributors

Contribute to Docs

Learn SQL on Codecademy

  • Learn to analyze data with SQL and prepare for technical interviews.
    • Includes 9 Courses
    • With Certificate
    • Beginner Friendly.
      18 hours
  • In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.
    • Beginner Friendly.
      5 hours