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)