The SQL FLOOR function returns the largest integer that is smaller or equal to the input expression.
Description
The FLOOR function helps for approximating numeric values. It rounds the numeric expression to the value that is the largest number less than or equal to the input number.
SQL FLOOR Usage Notes
The FLOOR function takes one argument. The data type is exact numeric or approximate numeric (like currency). The FLOOR function does not accept the bit data type for the input numeric expression.
The return type is the same as the input numeric expression.
Syntax
FLOOR (input_numeric_expression)
SQL FLOOR Examples
The following SQL query displays results after applying the FLOOR function to positive and negative integer input expressions.
The positive values approximate 198, and the negative value approximates to -199.
The following example applies the SQL FLOOR function to a currency value.
The FLOOR function returns 125 for the positive currency and -126 for the negative currency value.
The following examples use the AdventureWorks2019 database.
The FLOOR function returns the greatest least integer against each value in the Average Rate column of the Currency Rate table.