Syntax
FLOOR(expr)
Purpose
This function is similar to the CEIL(expr) function. You can call this function to return the maximum integer smaller than or equal to the specified expression.
Comparison operations are also supported. The comparison result is a Boolean value, which is converted into a numeric value. The result is 1 (TRUE) or 0 (FALSE).
If you enter NULL, NULL is returned.
If you enter a string of digits, it can be automatically converted into a numeric value.
The return value is converted into a BIGINT value.
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 (0.01 sec)
obclient> SELECT FLOOR('2');
+------------+
FLOOR('2')
+------------+
2
+------------+
1 row in set (0.00 sec)