The FLOOR function returns the largest integer that is less than or equal to a specified numeric value.
Some business calculations require values to be rounded downward to represent complete units only.
Calculate the number of complete packages that can be created from available items.
SELECT
FLOOR(UnitsAvailable / 10.0) AS CompletePackages
FROM Inventory;
FLOOR is useful in inventory calculations, packaging, capacity planning, and resource allocation.
- FLOOR rounds downward.
- The result is less than or equal to the original value.
- It is useful for complete-unit calculations.
- It differs from normal rounding.
- Function names can vary between databases.
What does FLOOR do?
FLOOR returns the largest integer less than or equal to the specified value.
What is the difference between FLOOR and CEILING?
FLOOR rounds downward while CEILING rounds upward.