What is an aggregate function in SQL?

Answer

Aggregate functions perform calculations on a set of rows and return a single value. Common functions: COUNT(*) — number of rows; SUM(column) — total of values; AVG(column) — average; MAX(column) — maximum; MIN(column) — minimum. Used with GROUP BY to compute aggregates per group: SELECT dept_id, COUNT(*) FROM employees GROUP BY dept_id. HAVING filters groups after aggregation (like WHERE for groups): HAVING COUNT(*) > 10. Aggregate functions ignore NULL values (except COUNT(*) which counts all rows).