Beginner

208. CEILING Function

Learn how to round a numeric value upward to the nearest integer.

📘 Lesson 208 of 728 ⏱ 8 min 🎯 Intermediate

The CEILING function returns the smallest integer that is greater than or equal to a specified numeric value.

Some business calculations require values to be rounded upward rather than using normal rounding rules.

Round a required number of delivery boxes upward when partial boxes are not possible.

SQL
SELECT
    CEILING(UnitsRequired / 10.0) AS BoxesRequired
FROM Orders;

CEILING is useful in inventory planning, packaging, capacity planning, billing, and resource calculations.

  • CEILING rounds upward.
  • The result is greater than or equal to the original value.
  • It is useful for capacity calculations.
  • It differs from normal rounding.
  • Function names can vary between databases.
What does CEILING do?

CEILING returns the smallest integer greater than or equal to the specified value.

When is CEILING useful?

It is useful when partial units are not practical, such as boxes, packages, or capacity requirements.

Have you finished this lesson?

Introduction to SQL – All Lessons