Reading employee and supervisor aliases

A company stores employees and their immediate supervisors in the following Staff table. The column staff_id uniquely identifies each employee, and manager_id contains that employee's supervisor's staff_id. NULL indicates no supervisor.


staff_id

name

office

manager_id

301

Nora

West

NULL

302

Omar

East

301

303

Priya

West

301

304

Quinn

East

302

305

Rosa

West

302

306

Seth

East

303


The company runs this query:


SQL
SELECT e.name AS employee, m.name AS supervisor
FROM Staff AS e
INNER JOIN Staff AS m
    ON e.manager_id = m.staff_id
WHERE m.office = 'West'
ORDER BY e.staff_id;


Complete the three output rows below in the order returned by the query. Enter each person's name exactly as shown in the source table.

Output rowemployeesupervisor
1
2
3

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Multiple Table Queries Questions: