How to store the PayPal decimal amount in the MySQL database?


In order to store PayPal decimal amount in the MySQL database, you can use DECIMAL(10,2). Let us first create a table −

mysql> create table DemoTable1491
   -> (
   -> Amount DECIMAL(10,2)
   -> );
Query OK, 0 rows affected (0.66 sec)

Insert some records in the table using insert command −

mysql> insert into DemoTable1491 values(987664.50);
Query OK, 1 row affected (0.14 sec)
mysql> insert into DemoTable1491 values(18783874.90);
Query OK, 1 row affected (0.10 sec)
mysql> insert into DemoTable1491 values(35363738.50);
Query OK, 1 row affected (0.15 sec)

Display all records from the table using select statement −

mysql> select * from DemoTable1491;

This will produce the following output −

+-------------+
| Amount      |
+-------------+
|   987664.50 |
| 18783874.90 |
| 35363738.50 |
+-------------+
3 rows in set (0.00 sec)

Updated on: 11-Dec-2019

92 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements