The infamous question about datatypes when storing money values in an SQL database.
However in these trying times, we now have currencies that have worth up to 18 decimal places (thank you ETH).
This now reraises the classic argument.
IDEAS
Option 1 BIGINT
Use a big integer to save the real value, then store how many decimal places the currency has (simply dividing A
by 10^B
in translation)?
Option 2 Decimal(60,30)
Store the datatype in a large decimal, which inevitibly will cost a large amount of space.
Option 3 VARCHAR(64)
Store in a string. Which would have a performance impact.
I want to know peoples thoughts and what they are using if they are dealing with cryptocurrency values. As I am stumped with the best method for proceeding.