Round off of column in Postgresql (Round() Function)

In order to Round off the column in postgresql we use ROUND() function. ROUND() Function in postgresql Round off the value. Let’s see how to

  • round off the value in postgresql – ROUND()
  • Round off value to decimal places in postgresql
  • Create the column which round off the value of the column

With an example for each

 

Get ROUND() in Postgresql:

ROUND() function in posgresql gets the round off value

SELECT ROUND(5.7) AS "Round off";

So the round off value will be

Round off in postgresql 2

 


SELECT ROUND(5.69677,2) AS "Round off";

So the round off value will be for two decimal places

Round off in postgresql 3

 

Get ROUND() of column in Postgresql table:

We use table states

Round off in postgresql 1


SELECT *,ROUND(hindex_score) as Round_off  FROM states

We have created a column and stored round off value of hindex_score

So the resultant table will be

Round off in postgresql 4

 

Round off the column to decimal places in Postgresql table:

Rounding off column to two decimal places is shown below


SELECT *,ROUND(hindex_score,2) as Round_off  FROM states

We have created a column and stored round off value of hindex_score to two decimal places

So the resultant table will be

Round off in postgresql 5