Skip to content
RED SAGSkills

Employees Without a Manager

In the employees table, manager_id holds the emp_id of the person each employee reports to. Top-level people have a NULL manager_id.

List the employees who have no manager.

Return columns emp_id, name. Row order does not matter.

Schema

CREATE TABLE employees (
  emp_id INTEGER PRIMARY KEY,
  name TEXT NOT NULL,
  manager_id INTEGER
);

Sample data

employees

emp_idnamemanager_id
1Aisha RahmanNULL
2Ben Carter1
3Chen Wei1
4Divya Nair2
5Elena Petrova2
6Farid Haddad3
Hint 1

Comparing with = NULL is never true. Use IS NULL.

Hint 2

A manager_id of 0 is a value, not a missing manager.

Good practice for: Data Analyst, Backend Developer, Database Administrator

SQL (SQLite)

Run checks your query on the sample data (Ctrl + '). Submit also checks hidden databases.