PostgreSQLNumeric FunctionsROUND
FLOOR

ROUNDNumeric Functions

TRUNC

Rounds x to s decimal places.

Syntax

ROUND(x [, s])

Example

Enter values below to update the example in real time.

product_id
rating
avg_rating
reviews
SELECT product_id, ROUND(AVG(rating)::numeric, 1) AS avg_rating
FROM reviews
GROUP BY product_id;