
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How to round down to nearest integer in MySQL?
To round down to nearest integer, use FLOOR() function from MySQL. The syntax is as follows −
SELECT FLOOR(yourColumnName) from yourTableName;
Let us first create a table −
mysql> create table FloorDemo -> ( -> Price float -> ); Query OK, 0 rows affected (0.57 sec)
Insert records to column Price. The query to insert records is as follows −
mysql> insert into FloorDemo values(5.75); Query OK, 1 row affected (0.21 sec) mysql> insert into FloorDemo values(5.23); Query OK, 1 row affected (0.31 sec) mysql> insert into FloorDemo values(5.50); Query OK, 1 row affected (0.12 sec)
Display the records present in the table with the help of select statement. The query is as follows −
mysql> select *from FloorDemo;
Here is the output −
+-------+ | Price | +-------+ | 5.75 | | 5.23 | | 5.5 | +-------+ 3 rows in set (0.00 sec)
We have 3 records and we want the nearest integer. For that, use the FLOOR() function as we have discussed above.
The query is as follows that implmenets FLOOR() function −
mysql> SELECT FLOOR(Price) from FloorDemo;
Here is the output −
+--------------+ | FLOOR(Price) | +--------------+ | 5 | | 5 | | 5 | +--------------+ 3 rows in set (0.03 sec)
- Related Articles
- Round to nearest integer towards zero in Python
- Round number down to nearest power of 10 JavaScript
- Round seconds to nearest half minute in MySQL?
- Round elements of the array to the nearest integer in Numpy
- Mean of an array rounded down to nearest integer in JavaScript
- How to round off to nearest thousands?
- How to round to the nearest hundred in R?
- How to round off numbers In nearest $100$.
- How to round up to the nearest N in JavaScript
- How to round off the numbers nearest tens?
- Round off 1120 to nearest hundred.
- How to round the decimal number to the nearest tenth in JavaScript?
- Round off to the nearest thousand.$5914$
- Round off 4200 to the nearest thousands.
- We have to round off 42 to nearest 10s

Advertisements