mysql的ROUND(X,D);ROUND(X)函数运用实例
程序员文章站
2022-03-23 21:00:57
语法:
ROUND(X)
ROUND(X, D)
注解:
四舍五入返回整数
四舍五入返回D位小数(如果D为负数,四舍五入整数部分)
举例与结果:
SELECT R...
语法:
ROUND(X)
ROUND(X, D)
注解:
四舍五入返回整数
四舍五入返回D位小数(如果D为负数,四舍五入整数部分)
举例与结果:
SELECT ROUND(14159.14159); # 14159 SELECT ROUND(14159.14159, -2); # 14200 SELECT ROUND(14159.14159, -1); # 14160 SELECT ROUND(14159.14159, 0); # 14159 SELECT ROUND(14159.14159, 1); # 14159.1 SELECT ROUND(14159.14159, 2); # 14159.14 SELECT ROUND(14159.14159, 3); # 14159.142