Syntax
FLOOR(expr)
Purpose
The FLOOR function is similar to the CEIL(expr) function. It returns the largest integer that is less than or equal to the specified expression.
The function supports comparison operations, and the result is a BOOLEAN value, which is converted to a numeric type. The result is 1 for TRUE and 0 for FALSE.
If the input is NULL, the return value is NULL.
If the input is a string of pure numbers, it can be automatically converted to a 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
