- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
MySQL float data field not accepting every float number? How to fix this?
To get fixed float data type, use DECIMAL(). This will fix the issue of unacceptance. Let us first create a table −
mysql> create table DemoTable(Amount DECIMAL(10,2)); Query OK, 0 rows affected (0.54 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values(2194848.90); Query OK, 1 row affected (0.65 sec) mysql> insert into DemoTable values(90309393.79); Query OK, 1 row affected (0.25 sec) mysql> insert into DemoTable values(8999999.68); Query OK, 1 row affected (0.30 sec) mysql> insert into DemoTable values(90900000.99); Query OK, 1 row affected (0.26 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+-------------+ | Amount | +-------------+ | 2194848.90 | | 90309393.79 | | 8999999.68 | | 90900000.99 | +-------------+ 4 rows in set (0.00 sec)
Advertisements