Write a postgre SQL Subquery to find the first_name, last_name and salary of the employees who earn more than the average salary and works in any of the IT departments
Write a postgre SQL Subquery to find the first_name, last_name and salary of the employees who earn more than the average salary and works in any of the IT departments.
SELECT first_name, last_name, salary
FROM employees
WHERE department_id IN
(SELECT department_id
FROM departments
WHERE department_name LIKE 'IT%')
AND salary > (
SELECT avg(salary)
FROM employees);
Sample table: employees
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer