floor function
The floor function returns the largest integer that is less than or equal to the specified expression.
Syntax:
number floor(n)
Semantics:
-
n: The argument n is an expression that resolves to a number.
-
return type:
-
Returns the same type as the argument n.
-
Returns a NULL value in the following cases:
-
n resolves to a NULL value
-
n does not resolve to a number
-
-
Returns NaN if n resolves to NaN.
-
Returns a positive/negative infinity if n resolves to the respective infinity.
-
Returns a positive/negative zero if n resolves to the respective zero value.
-
Example 1 - floor function
SELECT floor(n) FROM Userstocks
| Value of n | Output |
|---|---|
| 1.34 | 1.0 |
| -1.34 | -2.0 |
| pi() | 3.0 |