SQL ROUND()函數
ROUND(X)
ROUND(X,D)
此函數返回X四捨五入到最接近的整數。如果第二個參數D提供,則函數返回x四捨五入至小數點後D位。 D必須爲正數或全部在小數點右側的位將被刪除。考慮下面的例子:
SQL>SELECT ROUND(5.693893);
+---------------------------------------------------------+
| ROUND(5.693893) |
+---------------------------------------------------------+
| 6 |
+---------------------------------------------------------+
1 row in set (0.00 sec)
SQL>SELECT ROUND(5.693893,2);
+---------------------------------------------------------+
| ROUND(5.693893,2) |
+---------------------------------------------------------+
| 5.69 |
+---------------------------------------------------------+
1 row in set (0.00 sec)