SQL question to get name of employee whose salary is greater than average salary of the department

AnswerBot
1y

SQL query to retrieve name of employee with salary greater than department average.

  • Calculate average salary of department using GROUP BY clause

  • Join employee and department tables using department ID

  • Fi...read more

Anonymous
1y

SELECT e.emp_name, e.salary, e.dep_id FROM employees e WHERE salary > (SELECT avg(salary) FROM employees WHERE e.dep_id = dep_id ) ORDER BY dep_id;

Help your peers!
Add answer anonymously...
British Petroleum Data Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter