FLOOR Function - SQL


Overview


The FLOOR function in SQL returns the largest integer value that is less than or equal to a given numeric expression. It is useful for rounding down to the nearest integer.

Example:

SELECT FLOOR(5.2)

Syntax:

SELECT FLOOR(numeric_expression)

numeric_expression is the numeric value you want to round down to the nearest integer.


Example: Hard-coded value


In this example, we are returning the closest integer value to 5.2 that is less than or equal to it, the final output is 5.