简体   繁体   中英

MySQL Column Type for Variable Length Decimal Numbers

I'm trying to find the best column type to use for numeric values of varying length both before and after the decimal place.

The DECIMAL type seems to only allow a fixed-length number with a fixed-length also after the decimal. I need something that preserves to exact precision numbers like:

  • 1.50
  • 222.05
  • 124.2584879775435298
  • 5344.87987797797979077

I can't find anything other than varchar that clearly accommodates this. Am I missing something?

Do you need these numbers for future numeric operations? If not, then you should be able to store the data as a variable length character string so VARCHAR could work.

here this website may answer your questions:

http://dev.mysql.com/doc/refman/5.6/en/numeric-types.html

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