Which MySQL data type is used for long decimal?

MySQLMySQLi Database

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)
raja
Published on 11-Dec-2019 05:32:20
Advertisements