PostgreSQL ROUND
From w3cyberlearnings
Contents |
Postgresql ROUND
This function rounds a given number to D decimal places for two parameters input. For single parameter, it is round to the nearest integer. The rule for the ROUND function is that it round half up or round toward nearest. A value is a fraction of .5.
Syntax ROUND
ROUND(X); OR ROUND(X,Y);
Example 1
postgres=# SELECT ROUND(2.2); round ------- 2 (1 row) postgres=# SELECT ROUND(2.5); round ------- 3 (1 row)
Example 2
postgres=# SELECT ROUND(14.13,3); round -------- 14.130 (1 row) postgres=# SELECT ROUND(145.454234,3); round --------- 145.454 (1 row)