FLOOR
Rounds expr down to the nearest integer.
Syntax
sql
FLOOR(expr)Arguments
expr: The numeric value to be processed or a value of another data type that can be converted to a numeric value.
Return Values
The return value is an INTEGER.
Usage Notes
When rounding negative numbers, the value is further away from 0. Example: FLOOR(-5.1) = -6 (and not -5).
Example
sql
SELECT floor(91.91), floor(-91.91), floor('-91.91'), floor(-'91.91'), floor(10);+--------------+---------------+-----------------+-----------------+-------------+
| FLOOR(91.91) | FLOOR(-91.91) | FLOOR('-91.91') | FLOOR(-'91.91') | FLOOR(10) |
|--------------+---------------+-----------------+-----------------+-------------|
| 91 | -92 | -92 | -92 | 10 |
+--------------+---------------+-----------------+-----------------+-------------+