Beginner

253. FLOOR Function

Learn how to round a number downward to the nearest integer.

📘 Lesson 253 of 728 ⏱ 8 min 🎯 Beginner

The FLOOR function returns the largest integer that is less than or equal to a numeric value.

Some business calculations require only complete units and therefore need values rounded downward.

Calculate how many complete packages can be created from available items.

SQL
SELECT
    ProductName,
    FLOOR(AvailableQuantity / 10.0) AS CompleteBoxes
FROM Inventory;

FLOOR is useful in inventory, packaging, capacity calculations, pricing, and resource planning.

  • FLOOR rounds downward.
  • It returns the largest integer not greater than the value.
  • It is useful for complete-unit calculations.
  • It differs from ROUND.
  • Database support can vary.
What does FLOOR do?

FLOOR returns the largest integer that is less than or equal to the supplied number.

What is the difference between FLOOR and CEILING?

FLOOR rounds downward while CEILING rounds upward.

Have you finished this lesson?

Introduction to SQL – All Lessons