-
Notifications
You must be signed in to change notification settings - Fork 424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
关于金额字段为什么不用decimal类型? #26
Comments
#16 貌似说过了,为什么不用 decimal 我也想知道 |
是不是为储存和更高精度的计算? |
我觉得还是为了计算方便吧,即使数据库存储是decimal的,应用中处理浮点数也是比较头疼的。 |
主要两个原因:
对于 @bluntdel 说的精度变化,是指比如中国现在精度是2位小数,某天变成3位了吗? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
我看看了你那个支付流水表
金额是用2个字段来储存的,为什么不用decimal来储存?
total_fee
INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '支付金额,整数方式保存',scale
TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '金额对应的小数位数',请问这样有什么好处或者问题?
The text was updated successfully, but these errors were encountered: