Ordering
Limiting the output
Eliminating duplicate results
Aggregation
Grouping
HAVING: filtering and ordering groups
23. Filter groups continued
Let's practice

Instruction

You're getting really good! Now, let's do one more exercise on filtering groups. Are you ready?

Exercise

Find all departments where the average salary in 2012 was greater than 3000. Show the department name together with the average salary. Name the column AvgDepartmentSalary.

Stuck? Here's a hint!

Type:

SELECT
  Department,
  AVG(Salary) AS AvgDepartmentSalary
FROM Employee
WHERE Year = 2012
GROUP BY Department
HAVING AVG(Salary) > 3000;