[SQL] use correlated subquery to find all employees whose salary is above average for their department

Data Science Interview QuestionsCategory: Data Science[SQL] use correlated subquery to find all employees whose salary is above average for their department
MockInterview Staff asked 1 year ago
2 Answers
MockInterview Staff answered 1 year ago
SELECT employee_number, name
   FROM employees emp
   WHERE salary > (
     SELECT AVG(salary)
       FROM employees
       WHERE department = emp.department);

Your Answer

13 + 1 =