MySQL☞数值处理函数

1、round():四舍五入函数

round(数值,参数):如果参数的值为正数,表示保留几位小数,如果参数的值为0,则只保留正数部分们如果参数的值为负数,表示对小数点前第几位进行四舍五入。

Eg:(1)select round(45.926,2) from dual

    MySQL☞数值处理函数

  (2)select round(45.926,1) from dual

    MySQL☞数值处理函数

  (3)select round(45.926,0) from dual

    MySQL☞数值处理函数

  (4)select round(45.926,-1) from dual

    MySQL☞数值处理函数

  (5)select round(45.926,-2) from dual

    MySQL☞数值处理函数

  (6)select round(51.926,-2) from dual

    MySQL☞数值处理函数

2、ceil(数值):向上取整

Eg:(1)select ceil(10.99) from dual

   MySQL☞数值处理函数

  (2)select ceil(10.11) from dual

    MySQL☞数值处理函数

3、floor(数值):向下取整

Eg:select floor(10.11) from dual

    MySQL☞数值处理函数

4、mod(参数1,参数2):求出余数

Eg:select mod(10,4)from dual

    MySQL☞数值处理函数

5、sqrt(数值):求出平方根

Eg:(1)select sqrt(9)from dual

  MySQL☞数值处理函数

  (2)select sqrt(10)from dual

  MySQL☞数值处理函数

6、power(底数,指数):返回某数的乘幂

  MySQL☞数值处理函数2是底数,9是指数

Eg:select power(10, 2) from dual

    MySQL☞数值处理函数

上一篇:使用spring boot访问mongodb数据库


下一篇:springboot(十一):Spring boot中mongodb的使用