Write a SQL query using GROUP BY and HAVING to find departments where the average salary is greater than $50,000.