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
Loading playground environment...
Loading playground environment...
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.
Cite this resource
SQLSimplified. "FLOOR() SQL Function". Available at: https://sqlsimplified.online/reference/floor