Filter Employees Table by Average Salary
Find departments having an average salary greater than 100000.
sql
SELECT department_id, AVG(salary) AS average_salary FROM employees GROUP BY department_id HAVING AVG(salary) > 100000;
This query groups the "employees" table by "department_id" and filters the results to return only those departments where the calculated average of the "salary" column exceeds 100,000.
PromptDB can make mistakes. Please double-check responses.