When MySQL stores currency fields with precision to points, do you use int or decimal

problem description

when money is involved in the business system, there may be 1.11 CNY. Does int or decimal, have any advantages and disadvantages when multiplying the amount by 100 to save as int 111 or as decimal 1.11 MySQL to store the currency field with precision to points?

Apr.07,2021

of course, int, general units are stored according to points, when showing to customers, the conversion to yuan
computers are inherently unsuitable for dealing with decimals, slow!
and there is still no precision problem


We eliminate the decimal point

by 1000 or 10000 on the basis of the original value.
Menu