Ask Your Question
3

How can I round a number in Postgres SQL to two decimal places?

asked 2021-11-22 11:00:00 +0000

scrum gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2021-08-13 21:00:00 +0000

plato gravatar image

You can use the ROUND() function in Postgres SQL to round a number to two decimal places. The syntax is as follows:

ROUND(number, 2)

For example, if you want to round the number 3.14159 to two decimal places, you can use the following query:

SELECT ROUND(3.14159, 2);

The result will be 3.14.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-11-22 11:00:00 +0000

Seen: 9 times

Last updated: Aug 13 '21