In this guide, we will explain how to use the MySQL FLOOR function with syntax and examples.
Description
The MySQL FLOOR function returns the largest integer value that is equal to or less than a number.
Syntax
The syntax for the FLOOR function is:
FLOOR( number )
Parameters or Arguments
number
The value is used to find the largest integer value.
Note
- See also the ROUND, CEIL, CEILING, and TRUNCATE functions.
- See also the DIV function.
Applies To
The FLOOR function can be used in the following versions :
- MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23
Example
Let’s look at some FLOOR function examples and explore how to use the FLOOR function.
For example:
mysql> SELECT FLOOR(32.65); Result: 32 mysql> SELECT FLOOR(32.1); Result: 32 mysql> SELECT FLOOR(32); Result: 32 mysql> SELECT FLOOR(-32.65); Result: -33 mysql> SELECT FLOOR(-32.1); Result: -33 mysql> SELECT FLOOR(-32); Result: -32
Next Topic : Click Here
Pingback: MySQL: EXP Function | Adglob Infosystem Pvt Ltd