programming-examples/sql/SubqueriesHRDatabase/Write a query to identify all the employees who earn more than the average and who work in any of the IT departments.sql
2019-11-18 14:05:53 +01:00

12 lines
374 B
SQL

/*Write a query to identify all the employees who earn more than the average and who work in any of the IT departments.
*/
SELECT last_name
FROM employees
WHERE department_id IN
(SELECT department_id
FROM departments
WHERE department_name LIKE 'IT%')
AND salary >
(SELECT avg(salary)
FROM employees);