Be sure to use decimal to identify the currency value in mysql. Be sure to use decimal to identify the currency value in mysql! Do not use float. For example: CreateTableLedgerEntries (LedgerEntryIDIntPrimaryKeyAuto_IncrementNotNull, CustomerIDIntNotNull, AmountFloatNotNull );
Be sure to use decimal to identify the currency value in mysql. Be sure to use decimal to identify the currency value in mysql! Do Not use float. Example: Create Table LedgerEntries (LedgerEntryID Int Primary Key Auto_Increment Not Null, CustomerID Int Not Null, Amount Float Not Null );
Note: mysql must use decimal to identify the currency value.
Note that decimal must be used to identify the currency value in mysql! Do not use float. For example:
Create Table LedgerEntries
(
LedgerEntryID Int Primary Key Auto_Increment Not Null
, CustomerID Int Not Null
, Amount Float Not Null
);
Then insert some data;
Insert Into LedgerEntries (mermerid, Amount)
Values (1, 3.14 );
Insert Into LedgerEntries (mermerid, Amount)
Values (1, 30000.14 );
Last Query
Select * From LedgerEntries;
+ --------------- + ------------ + --------- +
| LedgerEntryID | CustomerID | Amount |
+ --------------- + ------------ + --------- +
| 1 | 1 | 3.14 |
| 2 | 1 | 30000.1 |
+ --------------- + ------------ + --------- +
Have you seen it? No last one !, Therefore, use decimal.
Create Table LedgerEntries
(
LedgerEntryID Int Primary Key Auto_Increment Not Null
, CustomerID Int Not Null
, Amount Decimal (10, 2) Not Null
);
Insert Into LedgerEntries (mermerid, Amount)
Values (1, 3.14 );
-- This is the largest value we can insert into a Decimal (10, 2)
-- If we have two numbers to the right of the decimal point
Insert Into LedgerEntries (mermerid, Amount)
Values (1, 99999999.99 );
Select * From LedgerEntries;
+ --------------- + ------------ + ------------- +
| LedgerEntryID | CustomerID | Amount |
+ --------------- + ------------ + ------------- +
| 1 | 1 | 3.14 |
| 2 | 1 | 99999999.99 |
+ --------------- + ------------ + ------------- +
2 rows in set (0.00 sec)