Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
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 such departments where the average salary in 2012 was higher than $3,000. Show the department name with the average salary.

Stuck? Here's a hint!

Type:

SELECT
  department,
  AVG(salary)
FROM employees
WHERE year = 2012
GROUP BY department HAVING AVG(salary) > 3000;