0 day streak
sql / beginner
Snippet

Computing Column Averages with the AVG Function

The AVG aggregate function calculates the arithmetic mean of non-NULL values across all rows in a numeric column.

snippet.sql
sql
1
SELECT AVG(salary) AS average_salary FROM employees;
Breakdown
1
SELECT AVG(salary) AS average_salary FROM employees;
Calculates the mathematical mean of values in the salary column and returns it with the alias average_salary.