Beginner

633. Employees Without Manager

Find employees who do not have a manager assigned.

📘 Lesson 633 of 728 ⏱ 13 min 🎯 Intermediate

Employees without managers can be identified by checking for NULL ManagerID values or unmatched manager records using a Self JOIN.

This is useful for identifying top-level employees and checking organizational hierarchy data quality.

Find employees whose ManagerID is missing.

SQL
SELECT
    e.EmployeeID,
    e.EmployeeName
FROM Employees e
LEFT JOIN Employees m
    ON e.ManagerID = m.EmployeeID
WHERE m.EmployeeID IS NULL;

Used in HR data validation, organization charts, access workflows, and management reporting.

  • LEFT JOIN preserves employee rows.
  • NULL manager matches can be identified afterward.
  • This can identify top-level employees.
  • It can also expose invalid ManagerID values.
  • Always distinguish missing managers from invalid references.
How can you find employees without managers?

Use a LEFT Self JOIN and filter where the manager-side EmployeeID is NULL.

Can this query identify invalid ManagerID values?

Yes. An unmatched manager reference can also produce a NULL manager-side record.

Have you finished this lesson?

Introduction to SQL – All Lessons