▶ SQL Playground
Q2 EASY · Self Join

Employees earning more than their manager

Given an Employee table where ManagerID points to another EmployeeID in the same table, find all employees who earn more than their direct manager.

Try this problem in the playground

The sample tables will be auto-loaded — write a query and run it instantly.

▶ Open Playground

Setup & sample data

The playground will create these tables and populate them automatically when you click "Open Playground" above:

Solutions

Multiple approaches — try each and understand the trade-offs.

Expected output