Rounding Functions
floor
Returns the largest rounded number less than or equal x.
A rounded number is a multiple of 1 / 10 * N, or the nearest number of the appropriate data type if 1 / 10 * N isn't exact.
Integer arguments may be rounded with negative N argument, with non-negative N the function returns x, i.e. does nothing.
If rounding causes an overflow (for example, floor(-128, -1)), the result is undefined.
Syntax
floor(x[, N])
Parameters
- x- The value to round. Float*, Decimal*, or (U)Int*.
- N. (U)Int*. The default is zero, which means rounding to an integer. Can be negative.
Returned value
A rounded number of the same type as x.
Examples
Query:
SELECT floor(123.45, 1) AS rounded
Result: