Deviopath › PostgreSQL

Who Is Your Manager?

Medium · Joins

A self join joins a table to itself. Give the table two aliases (for example e for the employee and m for the manager) and match e.manager_id = m.id.

Return employee (the employee's name) and manager (their manager's name) for every employee. Employees without a manager must still appear, with manager as NULL. Sort by employee.

Next: Back Again in February