- 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
Which MySQL data type is used for long decimal?
For this, use DECIMAL(21,20). Let us first create a table −
mysql> create table DemoTable1493 -> ( -> LongValue DECIMAL(21,20) -> ); Query OK, 0 rows affected (0.48 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable1493 values(1.0047464644664677373); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable1493 values(5.999999484757773); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable1493 values(0.009994995885885); Query OK, 1 row affected (0.21 sec)
Display all records from the table using select statement −
mysql> select * from DemoTable1493;
This will produce the following output −
+------------------------+ | LongValue | +------------------------+ | 1.00474646446646773730 | | 5.99999948475777300000 | | 0.00999499588588500000 | +------------------------+ 3 rows in set (0.00 sec)
Advertisements