SQLQuokka
Start practicing
QuestionsLearnSandboxFeaturesRoadmapFAQ

Employees Out-Earning Their Managers

Unsolved

Microsoft's compensation team is auditing pay structures and wants to find employees who earn strictly more than their direct manager. Employees without a manager (`manager_id` is NULL) cannot be compared and should not appear. Write an SQL query that returns `employee_name`, `employee_salary`, `manager_name` and `manager_salary` for every such employee. Order the results by the employee's `employee_id` ascending.

SQL Query Editor (Ctrl+Enter to run)
0 characters · Valid
Canonical Solution Official

Official Solution is Hidden

Try solving the question with the schema explorer and hints first. When ready, reveal the verified canonical query and step-by-step logic breakdown.

Community Q&A & Discussion

Ask questions, share alternate queries, and explore solutions

0 comments
Asked By:
🏢 Microsoft🏢 Salesforce🏢 Oracle

Submission History

Your recent query executions and answer checks

Execution Pipeline:
FROM staff
Full source dataset
9 rows total
Ready. Type a query to see live execution.
Clause: Auto-Sync · AlaSQL Engine