← All SQL interview questions

Employees earning more than their manager

MediumJoins — Self JoinOracleEXL

An HR compensation review flags reporting pairs where the direct report is paid more than the person they report to.

staff_roster stores the manager as a self-reference in manager_id. Return employee_name, employee_salary, manager_name and manager_salary for every employee whose salary is strictly greater than their manager's salary.

Sample data

Table: staff_roster

14 row(s) · showing first 8

staff_idINTstaff_nameTEXTdepartmentTEXTmanager_idINTsalaryINT
1Radhika AnandLeadershipNULL3200000
2Vikram ChandraAnalytics11800000
3Nandini BoseAnalytics21450000
4Imran ShaikhAnalytics21920000
5Kavya ReddyData Engineering11750000
6Rohan DuttaData Engineering51600000
7Simran KaurData Engineering51810000
8Aakash VermaData Science12100000

Practising alone only goes so far — our live cohorts pair SQL depth with dashboards, agentic analytics projects and mock interviews.

Explore the program