SQL Round Function

前端 未结 7 1290
有刺的猬
有刺的猬 2021-01-13 10:00

round(45.923,-1) gives a result of 50. Why is this? How it is calculated?

(sorry guys i was mistaken with earlier version of this question suggestin

7条回答
  •  失恋的感觉
    2021-01-13 10:28

    one thing is in the round function first parameter is the number and the second parameter is the precision index from the decimal side.

    That means if precision index is 0 it is at the first decimal, -1 means before the decimal first number, 1 means right side of the first decimal i.e second decimal

    For example

    round(111.21,0)---------> return 111
    round(115.21,-1)--------->return 120
    round(111.325,2)---------->return 111.33
    round(111.634,1)-----------> return 111.6
    

提交回复
热议问题