首页 > 代码库 > ROUND(x,y)

ROUND(x,y)

ROUND(x,y) 用于对 x 进行四舍五入,并保留小数点后 y 位

mysql> SELECT ROUND(1.38,1), ROUND(1.38,0), ROUND(232.38,-1), ROUND(232.38,-2);+---------------+---------------+------------------+------------------+| ROUND(1.38,1) | ROUND(1.38,0) | ROUND(232.38,-1) | ROUND(232.38,-2) |+---------------+---------------+------------------+------------------+|           1.4 |             1 |              230 |              200 |+---------------+---------------+------------------+------------------+

 

 

 

 

    

ROUND(x,y)