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.
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.