The SQL math function
FLOOR() returns the largest integer that is less than or equal to a specified numeric value. It effectively rounds down a number to the nearest whole integer.
SELECT FLOOR(number)FROM table_name;
number- The value which will be floored / rounded down.
In this example, the following data is given, in a table named
FLOOR() function can be used to return the largest integer that is less than or equal to a given value:
SELECT employee_id, FLOOR(salary) AS floored_salaryFROM employees;
In this SQL statement, the
salary values are floored for each employee to get the
AS keyword is used to name the resulting column
floored_salary in the output.
The output will be: