MySQL DECIMAL数据类型 [英] MySQL DECIMAL data type

查看:109
本文介绍了MySQL DECIMAL数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MySQL中有一列类型为DECIMAL(2,1)的列.当我将数字10插入数据库时​​,它的读数为9.9.我希望它的读数为10.0.有任何想法吗?谢谢.

I have a column in MySQL with the type DECIMAL(2,1). When I insert the number 10 into the database it reads 9.9. I want it to read 10.0. Any ideas? Thanks.

推荐答案

DECIMAL(2,1)表示(如

DECIMAL(2,1) means (as the manual suggests) a decimal of 2 characters wide (in total!) and 1 decimal. If you want 10.0, you need DECIMAL(3,1) (three wide, one decimal).

这篇关于MySQL DECIMAL数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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