FLOOR()
Rounds a number down to the nearest integer (floor).
Description
FLOOR rounds a number down to the largest integer less than or equal to
it. Use it when you need to "round down" — for example, whole units you can ship
when partial units aren't allowed.
Syntax
FLOOR(expression)Parameters
| Name | Description | Optional |
|---|---|---|
| expression | A numeric column or expression. | No |
Return Type
Returns an integer type. The fractional part is discarded by rounding downward.
Examples
Store (Customers/Orders/Products)
Loading database engine...
Store (Customers/Orders/Products)
Loading database engine...
FLOOR vs CEIL
FLOOR always moves down (toward negative infinity); CEIL always moves up.
FLOOR(-2.3) is -3.
Common Mistakes
- Confusing with rounding.
FLOORalways goes down; useROUNDfor nearest. - Negative numbers.
FLOOR(-2.3)is-3, not-2. - Expecting decimals. The result is an integer.
Related Functions
See also: CEIL, ROUND.