How to Round Up in SQL

See SQL: Tips and Tricks for similar articles.
Looking to improve your SQL skills? Check out Webucator’s SQL classes.

In SQL, you round up to the nearest integer using the CEIL or CEILING function, depending on whether you're using SQL Server, Oracle, MySQL or PostgreSQL.

Rounding up in SQL Server

In SQL Server, you round up with the CEILING() function.

SELECT CEILING(5.2)
Output:
6

Rounding Up in Oracle, MySQL, and PostgreSQL

In Oracle, MySQL, and PostgreSQL, you can use either the CEIL() or CEILING() function to round up.

SELECT CEIL(5.2)
SELECT CEILING(5.2)
Output:
6

Related Articles

  1. Reset Root Password in MySQL on Windows
  2. How to Create an ER Diagram for a MySQL Database with Free Tools
  3. How to Round Up in SQL (this article)
  4. How to Concatenate Strings in SQL
  5. How to Select All Columns in a Row in SQL
  6. How to Check Multiple Conditions in SQL
  7. How Work with White Space and Semicolons in Simple SQL Selects
  8. How to Sort Records in SQL
  9. How to Write Subqueries (Simple and Correlated)