# Number of Direct Reports — 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/3069/number-direct-reports
Source observed: 2026-11-04T23:34:31.449Z
Last checked: 2026-11-04T23:34:31.449+00:00
Indexed: 2026-11-06T15:57:42.785+00:00

---

# Number of Direct Reports

**Difficulty:** Medium  
**Category:** [Coding](https://www.aced.io/questions?type=coding) · [SQL](https://www.aced.io/questions?type=sql)  
**Interview question:** Coding · Reported last asked: 3 years ago

## What we ask

Workday provides human capital management solutions for managing employees, their roles, and reporting structures. In this scenario, consultants identify an organization’s structure, including managers and the employees who report directly to them.

You are given an `employees` table with these columns:

| Column | Type | Description |
|---|---|---|
| `emp_id` | integer | Unique identifier for each employee. |
| `emp_name` | string | Name of the employee. |
| `manager_id` | integer | Employee ID of the manager to whom the employee reports. This can be `NULL` for top-level managers. |

Write a SQL query that returns the employee ID and name of every manager with at least 2 employees reporting directly to them. Sort the results by the number of direct reports in descending order.

Return exactly these columns:

- `manager_employee_id`
- `manager_name`
- `number_of_direct_reports`

## Practice options

We provide an editor with **Question**, **Solution**, **Community**, **Editor**, **Share**, **Output**, **Test Results**, and **Console** views. [Sign up to run code](https://www.aced.io/signup?src=lesson). Detailed company statistics for this question are available through [Upgrade](https://www.aced.io/upgrade?src=questions).

## Related question

- [What is the value of one-on-ones with your direct reports?](https://www.aced.io/questions/1507/value-of-one-on-ones)

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

---

[Read this page’s summary](https://www.aced.io/agents/api/public/v1/page-tldr?url=https%3A%2F%2Fwww.aced.io%2Fquestions%2F3069%2Fnumber-direct-reports&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%2F3069%2Fnumber-direct-reports). Opening a form does not execute a tool.