Browse and solve 1,200+ machine learning coding challenges on Deep-ML. Filter by difficulty (beginner, intermediate, advanced) and category (linear algebra, machine learning, deep learning, NLP, computer vision). Write Python solutions in the browser and get instant feedback against test cases.
You are given an employees table where each employee has an id, a name, a salary, and a manager_id that references the id of their manager (manager_id is NULL for employees who have no manager). Write a single SQL query that returns the names of all employees who earn a strictly higher salary than their own manager. Return one column named employee. The order of rows does not matter.
employees table with columns id, name, salary, manager_id
Bob Erin
Bob (95000) reports to Alice (90000), so Bob qualifies. Erin (100000) reports to Bob (95000), so Erin qualifies. Carol, Dave, and Frank all earn less than their managers, and Alice has no manager, so none of them are returned.