MYSQL:DECIMAL,逗号后精度为10位 [英] MYSQL: DECIMAL with accuracy of 10 digits after the comma

查看:307
本文介绍了MYSQL:DECIMAL,逗号后精度为10位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在MySQL中,我将DECIMAL字段设置为10,10.但是,每当我输入一个新值时,它就会显示0.9999999999.我需要更改什么才能接受逗号后精度为10位数的任何数字?出于某种原因,它确实可以使用10,6.

In MySQL I have a DECIMAL field set to 10,10. However, whenever I enter a new value, it shows 0.9999999999. What would I need to change to accept any number with an accuracy of 10 digits after the comma? It does work with 10,6 for some reason.

PS:我要输入汇率.

PS: I want to insert exchange rates.

推荐答案

第一个数字是要存储的总位数,第二个数字是小数部分的位数.因此,DECIMAL (10, 10)仅适用于10个小数位.您可以使用DECIMAL (20, 10)之类的东西在整数部分和小数部分都允许使用10位数字.

The first number is the total number of digits to store, the second one is the number of digits on the fractional part. So DECIMAL (10, 10) is only for 10 fractional digits. You can use something like DECIMAL (20, 10) to allow 10 digits on both the integral and fractional parts.

这篇关于MYSQL:DECIMAL,逗号后精度为10位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆