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.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2b0b5-2adc7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2b0b5-2adc7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?