SQLSQL
#36

Managers with at Least 5 Direct Reports in SQL

MediumAmazon
Interview Question #36
Asked at Amazon

Given an `employee` table (id, name, department, managerId), find the managers who have at least 5 direct reports.

Input Table: employee
6 rows preview
idnamemanagerId
101JohnNULL
102Dan101
103James101
104Amy101
105Anne101
106Ron101
Expected Output Structure1 rows
name
John
Interview Context

Asked frequently in data analyst and business analyst technical rounds. Focus on clean filtering, optimal indexing usage, and unambiguous column selection.

SQLPostgreSQL 15
Ready to execute

Click "Run Query" or press Ctrl + Enter to test your query.

Output will be verified against the test dataset.

Chat with us