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
SELECT ROUND(5.69677,2) AS "Round off";
So the round off value will be for two decimal places
Get ROUND() of column in Postgresql table:
We use table states
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 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