storing money amounts in mysql

后端 未结 7 672
野趣味
野趣味 2020-11-29 19:36

I want to store 3.50 into a mysql table. I have a float that I store it in, but it stores as 3.5, not 3.50. How can I get it to have the trailing zero?

7条回答
  •  误落风尘
    2020-11-29 20:25

    Why do you want to store "3.50" into your database? 3.5 == 3.50 == 3.5000 as far as the database is concerned.

    Your presentation and formatting of figures/dates/etc should be done in the application, not the database.

提交回复
热议问题