Round function 可將帶入的值依指定的位數下去做四捨五入運算並回傳。

使用語法如下:

ROUND( number [, decimal_places] )

number 是要做四捨五入的值,decimal_places 是要做四捨五入的位數。

這邊的 decimal_places 可以是正值,也可以是負值。如果是正值表示的是小數點後的位數,如果是負值則表示小數點前的位數。

寫起來就像下面這樣:

{% img /images/posts/RoundFunction/1.png %}

{% img /images/posts/RoundFunction/2.png %}

{% img /images/posts/RoundFunction/3.png %}

{% img /images/posts/RoundFunction/4.png %}

{% img /images/posts/RoundFunction/5.png %}