PostgreSQL

PostgreSQL AVG

Calculate the average of numeric values.

Calculate an average

AVG ignores null values and returns the arithmetic mean.

SELECT AVG(year) AS average_year
FROM products;

Use ROUND when you want to control the number of decimal places in a numeric result.