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)

Updated on: 11-Dec-2019

212 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements