MySQL: preferred column type for (product) prices?

前端 未结 5 1917
你的背包
你的背包 2021-01-30 19:34

In MySQL, what is the preferred column type for storing a product\'s price (or currencies in general)? Google learned me DECIMAL of FLOAT is often used, but I wonder which one i

5条回答
  •  别那么骄傲
    2021-01-30 19:59

    Decimal is wrong because if you want to set the price 12.99 decimal turn it to 13.00.So this is wrong but if you use float you can save it as 12.99. So the correct answer is float and varchar.

提交回复
热议问题