牛客MySQL-1.27

In a DECIMAL column declaration, the precision and scale can be (and usually is) specified. For example:

salary DECIMAL(5,2)
In this example, 5 is the precision and 2 is the scale. The precision represents the number of significant digits that are stored for values, and the scale represents the number of digits that can be stored following the decimal point.
Standard SQL requires that DECIMAL(5,2) be able to store any value with five digits and two decimals, so values that can be stored in the salary column range from -999.99 to 999.99.
In standard SQL, the syntax DECIMAL(M) is equivalent to DECIMAL(M,0). Similarly, the syntax DECIMAL is equivalent to DECIMAL(M,0), where the implementation is permitted to decide the value of M. MySQL supports both of these variant forms of DECIMAL syntax. The default value of M is 10.
If the scale is 0, DECIMAL values contain no decimal point or fractional part.
全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
正在热议
更多
# 春招至今,你的战绩如何? #
9578次浏览 87人参与
# 你的实习产出是真实的还是包装的? #
1710次浏览 40人参与
# 巨人网络春招 #
11301次浏览 223人参与
# 军工所铁饭碗 vs 互联网高薪资,你会选谁 #
7453次浏览 43人参与
# 简历第一个项目做什么 #
31555次浏览 330人参与
# 重来一次,我还会选择这个专业吗 #
433352次浏览 3926人参与
# MiniMax求职进展汇总 #
23843次浏览 308人参与
# 当下环境,你会继续卷互联网,还是看其他行业机会 #
186969次浏览 1122人参与
# 牛客AI文生图 #
21408次浏览 238人参与
# 不考虑薪资和职业,你最想做什么工作呢? #
152290次浏览 887人参与
# 研究所笔面经互助 #
118872次浏览 577人参与
# 简历中的项目经历要怎么写? #
310060次浏览 4193人参与
# AI时代,哪些岗位最容易被淘汰 #
63407次浏览 803人参与
# 面试紧张时你会有什么表现? #
30488次浏览 188人参与
# 你今年的平均薪资是多少? #
213009次浏览 1039人参与
# 你怎么看待AI面试 #
179861次浏览 1234人参与
# 高学历就一定能找到好工作吗? #
64313次浏览 620人参与
# 你最满意的offer薪资是哪家公司? #
76436次浏览 374人参与
# 我的求职精神状态 #
447984次浏览 3128人参与
# 正在春招的你,也参与了去年秋招吗? #
363243次浏览 2637人参与
# 腾讯音乐求职进展汇总 #
160584次浏览 1111人参与
# 校招笔试 #
470425次浏览 2963人参与
牛客网
牛客网在线编程
牛客网题解
牛客企业服务