且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在MySQL中存储小数?

更新时间:2023-01-30 16:01:09

DECIMAL声明的第一位数字是总数位数字.您可能要使用DECIMAL (4, 2).这样最多可以在小数点前两位和后两位.

The first digit of the DECIMAL declaration is the total digits. You probably want to use DECIMAL (4, 2). This allows for up to two digits before the decimal and two after.

文档: https://dev. mysql.com/doc/refman/5.7/en/precision-math-decimal-characteristics.html