LogiQuest

508. Above Department Average

MediumCorrelated Subquery

Return the name and salary of employees who earn more than the average salary of their own department, ordered by name.

departments

idnamecity
1EngineeringChennai
2SalesMumbai
3HRPune
4ResearchBengaluru

employees

idnameemailsalarydept_idmanager_idhired
1Ashaasha@corp.in1200001NULL2019-04-01
2Raviravi@corp.in90000112020-06-15
3Meenameena@corp.in85000212018-01-10
4Johnjohn@corp.in60000232021-09-01
5Sarasara@corp.in95000112022-02-20
6Imranimran@corp.in70000312020-11-05
7Latalata@corp.in55000232023-03-12
8Kiranasha@corp.in90000122021-07-30

Your query runs on a fresh copy of these tables (SQLite). Column names in your result do not need to match.

Loading the MyLoginn IDE…