HomeInterview QuestionsWrite an SQL query to count the number of employee…

Write an SQL query to count the number of employees reporting to each manager.

🟡 Medium Coding Junior level
1Times asked
Jun 2026Last seen
Jun 2026First seen

💡 Model Answer

Assuming the same Employees table with EmployeeID, EmployeeName, and ManagerID, you can group by the manager and count:

SELECT m.EmployeeName AS Manager,

   COUNT(e.EmployeeID) AS ReportCount

FROM Employees e

JOIN Employees m ON e.ManagerID = m.EmployeeID

GROUP BY m.EmployeeID, m.EmployeeName

ORDER BY ReportCount DESC;

This returns each manager and how many direct reports they have.

This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.

🎤 Get questions like this answered in real-time

Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers — invisible to screen sharing.

Get Assisting AI — Starts at ₹500