Published May 26, 2023
Contribute to Docs
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:
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn SQL on Codecademy
Analyze Data with SQLLearn to analyze data with SQL and prepare for technical interviews.
Includes 8 Courses