# Employee Earnings — SQL interview question

Aced (formerly Exponent) publishes a public search API over its indexed pages; the guide is at https://www.aced.io/agents/agent-access.

Source: https://www.aced.io/questions/3960/employee-earnings
Source observed: 2026-11-04T21:34:31.716Z
Last checked: 2026-11-04T21:34:31.716+00:00
Indexed: 2026-11-05T01:37:31.057+00:00

---

# Employee Earnings

We provide this medium-difficulty SQL coding question for interview preparation. The question concerns an `employees` table and asks you to identify employees whose salary is greater than their manager’s salary.

[All Questions](https://www.aced.io/questions)

## Question details

- **Interview count:** 5 interviews
- **Category:** Coding
- **Topic:** SQL
- **Roles:** [Data Engineer](https://www.aced.io/questions?role=data-engineer), [Data Scientist](https://www.aced.io/questions?role=data-science), [Data Analyst](https://www.aced.io/questions?role=data-analyst), [Software Engineer](https://www.aced.io/questions?role=swe)
- **Company:** [Garda Capital](https://www.aced.io/questions?company=Garda%20Capital)

## Schema

You are given the `employees` table:

| Column | Type |
|---|---|
| `id` | integer |
| `first_name` | string |
| `last_name` | string |
| `age` | integer |
| `sex` | string |
| `employee_title` | string |
| `department` | string |
| `salary` | integer |
| `targe` | integer |
| `bonus` | integer |
| `city` | string |
| `address` | string |
| `manager_id` | integer |

Find employees who are earning more than their managers. Output the employee’s first name along with the corresponding manager salary. The required output columns are:

- `first_name` — the employee’s first name
- `manager_salary` — the manager’s salary

## Community solutions

The following community-submitted SQL approaches answer the question.

### Fagbenro M. — 3 hours ago

```sql
SELECT e.first_name, m.salary AS manager_salary
FROM employees e
JOIN employees m
  ON e.manager_id = m.id
WHERE e.salary > m.salary;
```

[Profile: Fagbenro M.](https://www.aced.io/users/85053b3b-0b77-4c4c-b94f-7f11b701d999) · [194 karma](https://www.aced.io/karma "194 karma")

### Yash B. — October 7, 2026

```sql
WITH managers AS (
  SELECT id AS manager_id, salary AS manager_salary
  FROM employees
)
SELECT first_name, manager_salary
FROM employees a
JOIN managers b
  ON a.manager_id = b.manager_id
WHERE a.salary > b.manager_salary;
```

[Profile: Yash B.](https://www.aced.io/users/0c8f33fa-aec8-4243-a2ab-218465bb4355) · [367 karma](https://www.aced.io/karma "367 karma")

### Zacharias E. — July 29, 2026

This approach uses a self-join and places both join conditions in the `ON` clause:

```sql
SELECT E1.first_name, E2.salary AS manager_salary
FROM employees E1
JOIN employees E2
  ON E1.manager_id = E2.id
 AND E1.salary > E2.salary;
```

[Profile: Zacharias E.](https://www.aced.io/users/ce6132ab-e998-47bb-ad9a-aaa6a664b894) · [262 karma](https://www.aced.io/karma "262 karma")

### MnM — February 4, 2026

This submission describes the following as the fastest and simplest approach:

```sql
SELECT e.first_name, m.salary AS manager_salary
FROM employees e
LEFT JOIN employees m
  ON e.manager_id = m.id
WHERE m.salary < e.salary;
```

[Profile: MnM](https://www.aced.io/users/56727b13-02d1-4988-8288-65b3b51ddaf8) · [792 karma](https://www.aced.io/karma "792 karma")

### Riwa S. — June 29, 2026

```sql
SELECT first_name,
       (SELECT salary FROM employees x WHERE x.id = e.manager_id) AS manager_salary
FROM employees e
WHERE salary > manager_salary;
```

[Profile: Riwa S.](https://www.aced.io/users/ab88b126-e61c-43f2-8aa4-ac5935dff719) · [204 karma](https://www.aced.io/karma "204 karma")

## Related questions

- [Top Earning Employees](https://www.aced.io/questions/3044/top-earning-employees)
- [Lowest Earning Employees](https://www.aced.io/questions/4375/lowest-earning-employees)
- [Employee Hierarchy](https://www.aced.io/questions/3041/employee-hierarchy)

## Related courses

### [Data Analyst Interview Prep](https://www.aced.io/courses/data-analytics)

![Data Analyst Interview Prep](https://images.ctfassets.net/x78yjrjc11pq/72OTqij57b2TklhaD2vrdV/be0dae6242904970d1696e5a4d858e18/AdobeStock_1357126576.jpeg?w=800&h=800&fm=webp&q=75)

We help candidates prepare for data analyst interviews for product, marketing, and business analyst roles through real take-home case studies, technical and dashboarding practice, and strategies from interviewers at technology companies and startups.

### [Data Science Interview Prep](https://www.aced.io/courses/data-science)

![Data Science Interview Prep](https://images.ctfassets.net/x78yjrjc11pq/3U4C5C0OkDR0UeGch4AmlE/7ad489430b676a088cb973307fe77884/Data_Science_Interview_Prep_Course.jpeg?w=800&h=800&fm=webp&q=75)

We help candidates prepare for data science roles at Google, Amazon, Microsoft, Meta, Apple, and other companies with mock interviews, frameworks, and advice from senior candidates. Practice areas include statistics, experimentation, coding, SQL, machine learning, behavioral interviews, and more.

[Sign up to run code](https://www.aced.io/signup?src=lesson)

---

[Read this page’s summary](https://www.aced.io/agents/api/public/v1/page-tldr?url=https%3A%2F%2Fwww.aced.io%2Fquestions%2F3960%2Femployee-earnings&trace=t_679ff9ab98f3)

## Ask a follow-up about this page

Need a more specific answer? Ask the exact question you have. It returns a fresh, cited answer from Aced (formerly Exponent)’s knowledge base. No account or API key required.

Open this URL with your own question, URL-encoded. Include your question in q. All research inputs are optional; no account or setup.

`GET https://www.aced.io/agents/agent/faq?q={question}&trace=t_679ff9ab98f3`

[Tool guide and examples](https://www.aced.io/agents/agent-access) · [OpenAPI](https://www.aced.io/agents/api/public/v1/openapi.json) · [Page TLDR form](https://www.aced.io/agents/agent-tools/page-tldr?url=https%3A%2F%2Fwww.aced.io%2Fquestions%2F3960%2Femployee-earnings). Opening a form does not execute a tool.