1round():四舍五入函数

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

Eg1select round(45.926,2) from dual

         MySQL数值处理函数

  2select round(45.926,1) from dual

     MySQL数值处理函数

  3select round(45.926,0) from dual

     MySQL数值处理函数

  4select round(45.926,-1) from dual

     MySQL数值处理函数

  5select round(45.926,-2) from dual

     MySQL数值处理函数

  6select round(51.926,-2) from dual

     MySQL数值处理函数

2ceil(数值):向上取整

Eg1select ceil(10.99) from dual

       MySQL数值处理函数

  2select ceil(10.11) from dual

     MySQL数值处理函数

 

3floor(数值):向下取整

Egselect floor(10.11) from dual

      MySQL数值处理函数

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

Egselect mod(10,4)from dual

      MySQL数值处理函数

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

Eg1select sqrt(9)from dual

        MySQL数值处理函数

  2select sqrt(10)from dual

        MySQL数值处理函数

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

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

Egselect power(10, 2) from dual

     MySQL数值处理函数

 

相关文章: