简体   繁体   中英

mysql varchar(255) only storing numbers upto 4 decimal place , why?

I am working on a mysql table created by some other devloper, one of the column need to contain numerical values(with upto 10 decimal), i am updating the column with new decimal values(upto 10 decimal places), but when i am updating that column with the new values which are generated using a python script, numbers are automatically getting rounded to 4 decimal places while getting updated in table. the datatype for column is varchar(255), should i alter the column type to FLOAT(11,10).

use the decimal data type

decimal(14,10)

this is max number +9999,999999999 min number -9999,999999999 (this is 4 for the integer part, and 10 digits for the decimal part). (you can use other combinations).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM