This article will guide you on how to use the FLOOR() function, with its syntax and examples.
The FLOOR() returns a number rounded down that is less than or equal to the specified argument.
The syntax for the FLOOR() function in Oxla is:
The FLOOR() function requires one argument:
x: A positive or a negative decimal number (or an expression that evaluates to a decimal number).
Case #1: Rounding Down a Positive Decimal Value
The following example demonstrates how the FLOORL() function rounds down a positive decimal value:
It will return 345 as it is the closest value smaller than the argument.
Case #2: Rounding Down a Negative Decimal Value
The following example demonstrates how the FLOORL() function rounds down a negative decimal value:
You will get the following result as it is the nearest integer smaller than or equal to the specified argument.
Case #3: Using the FLOOR() Function With a Table
The following example demonstrates how the FLOOR() function can be used with a table to round down the values in a specific column:
1) Create a new table called FloorRecords with double-precision values using the query below:
2) Retrieve the table with its value by running the following query:
3) The return table will contain the following:
- numbers, the column with the initial double-precision values.
- FloorValue, the column with the rounded-down values.