SQLite FLOOR function

The SQLite FLOOR function is a built-in mathematical function that is used to round down a numeric value to the nearest integer value that is less than or equal to the input value. The FLOOR function is commonly used in SQL queries to manipulate numerical data.

Syntax

The syntax for the FLOOR function in SQLite is as follows:

FLOOR(numeric_value)

Where numeric_value is the value that you want to round down.

The FLOOR function takes a single argument, which is a numeric value, and returns the largest integer value that is less than or equal to the input value. For example, if the input value is 3.14, the FLOOR function would return 3. If the input value is -2.5, the FLOOR function would return -3.

Examples

Here are some examples of how the FLOOR function can be used in SQLite queries:

SELECT FLOOR(3.14); -- returns 3
SELECT FLOOR(-2.5); -- returns -3
SELECT FLOOR(5); -- returns 5
SELECT FLOOR(10.8); -- returns 10

In conclusion, the SQLite FLOOR function is a useful mathematical function that can be used to round down numerical values in SQL queries. It returns the largest integer value that is less than or equal to the input value.