round(x, s): Returns the value of x, optionally rounded to s decimal places : round « Math Functions « PostgreSQL






round(x, s): Returns the value of x, optionally rounded to s decimal places

postgres=#
postgres=# -- round(x, s): Returns the value of x, optionally rounded to s decimal places
postgres=# SELECT round(1.4949, 1) AS one_digit_scale,
postgres-#        round(1.4949, 3) AS three_digit_scale,
postgres-#        round(1.4949, 10) AS ten_digit_scale,
postgres-#        round(1.4949, 0) AS rounded;
 one_digit_scale | three_digit_scale | ten_digit_scale | rounded
-----------------+-------------------+-----------------+---------
             1.5 |             1.495 |    1.4949000000 |       1
(1 row)

postgres=#

           
       








Related examples in the same category

1.round(x): Returns x rounded to the nearest whole integer
2.SELECT round(4, 4)