PostgreSQLAggregate FunctionsAVG
SUM

AVGAggregate Functions

MIN

Returns the average.

Syntax

AVG(expr)

Example

Enter values below to update the example in real time.

category
price
avg_price
products
SELECT category, ROUND(AVG(price)::numeric, 2) AS avg_price
FROM products
GROUP BY category;