SQL · Pattern 4 — Aggregation
AVG
AVG() is the mean — sum divided by count — computed only over the non-NULL values in that column.
Source data — Pattern 4: Aggregation
All queries run against the shared employees table (see schema.sql) — no new columns needed for this pattern.

What it does
AVG() is the mean — sum divided by count — computed only over the non-NULL values in that column. Like SUM(), NULLs are excluded rather than counted as zero, which can quietly change the result if a column has gaps.
Problem
Find the average salary.
SELECT AVG(salary) AS average_salary
FROM employees;
Result
