Declaration
FLOOR(expr)
Description
Similar to the CEIL(expr) function, it returns the largest integer that is less than or equal to the specified expression.
Comparison operations are supported. The result is a BOOLEAN value, which is converted to a numeric type and processed to produce 1 (TRUE) or 0 (FALSE).
If NULL is input, the return value is NULL.
If a string of only digits is entered, it can be automatically converted to the numeric type.
The return value is converted to a BIGINT.
Examples
obclient> SELECT FLOOR(1.2), FLOOR(-1.2), FLOOR(1+1.5), FLOOR(1=1),FLOOR(1<1),FLOOR(null);
+------------+-------------+--------------+------------+------------+-------------+
| FLOOR(1.2) | FLOOR(-1.2) | FLOOR(1+1.5) | FLOOR(1=1) | FLOOR(1<1) | FLOOR(null) |
+------------+-------------+--------------+------------+------------+-------------+
| 1 | -2 | 2 | 1 | 0 | NULL |
+------------+-------------+--------------+------------+------------+-------------+
1 row in set
obclient> SELECT FLOOR('2');
+------------+
| FLOOR('2') |
+------------+
| 2 |
+------------+
1 row in set