PostgreSQL ROUND() function

ROUND() function

The PostgreSQL round() function is used to return the value after rounded a number upto a specific decimal places, provided in the argument.

Uses of ROUND() Function
• Rounding Numbers: To round a number to a specified number of decimal places.

• Financial Calculations: Useful in financial calculations where precise rounding is required.

• Data Presentation: To format numerical data for presentation purposes.

• Mathematical Operations: Employed in mathematical operations that require rounding results to a certain precision.

• Data Analysis: To round values in data analysis tasks to simplify results and improve readability.

Syntax:

```random()
```

PostgreSQL Version: 9.3

Pictorial presentation of PostgreSQL ROUND() function

Example 1: PostgreSQL ROUND() function

Code:

``````SELECT ROUND(67.456) AS "Round";
```
```

Sample Output:

``` Round
-------
67
(1 row)
```

Example 2: PostgreSQL ROUND() function

Code:

``````SELECT ROUND(67.456,1) AS "Round upto 1 decimal";
```
```

Sample Output:

``` Round upto 1 decimal
----------------------
67.5
(1 row)
```

Example 3: PostgreSQL ROUND() function

Code:

``````SELECT ROUND(67.456,2) AS "Round upto 2 decimal";
```
```

Sample Output:

``` Round upto 2 decimal
----------------------
67.46
(1 row)
```

Previous: RANDOM function
Next: SIGN function

﻿