MySQL数值处理函数
1、round():四舍五入函数
round(数值,参数):如果参数的值为正数,表示保留几位小数,如果参数的值为0,则只保留正数部分们如果参数的值为负数,表示对小数点前第几位进行四舍五入。
Eg:(1)select round(45.926,2) from dual
(2)select round(45.926,1) from dual
(3)select round(45.926,0) from dual
(4)select round(45.926,-1) from dual
(5)select round(45.926,-2) from dual
(6)select round(51.926,-2) from dual
2、ceil(数值):向上取整
Eg:(1)select ceil(10.99) from dual
(2)select ceil(10.11) from dual
3、floor(数值):向下取整
Eg:select floor(10.11) from dual
4、mod(参数1,参数2):求出余数
Eg:select mod(10,4)from dual
5、sqrt(数值):求出平方根
Eg:(1)select sqrt(9)from dual
(2)select sqrt(10)from dual
6、power(底数,指数):返回某数的乘幂
2是底数,9是指数
Eg:select power(10, 2) from dual