SQL Interview Question: Finding Departments Paying Above the Company Average Salary
A practical SQL interview problem asks for departments whose average salary exceeds the company-wide average. The article supplies two sample tables, one of employees with department IDs and salaries, and one of departments with names. The company-wide average is given as ₹67,500, and the IT department's average of ₹90,000 is the only one above it. The suggested solution uses a common table expression to compute each department's average and a subquery for the overall average, then filters the results. The author also poses a follow-up question about whether HR would qualify if a new ₹120,000 employee joined it.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in