~/ learn/ comp-378/ cards/ Joins II: OUTER (LEFT/RIGHT/FULL), SELF JOIN & CROSS JOIN
1 of 6

Type the self-join that pairs each employee with their manager:

Type the self-join that pairs each employee with their manager:

Answer

SELECT e.name AS employee, m.name AS manager FROM employees e JOIN employees m ON m.emp_id = e.manager_id ORDER BY e.name;

Two aliases (e, m) make one table act as two roles; the ON links the subordinate row to its manager row via the recursive FK manager_id → emp_id.

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/3cdcfe21-898c-4856-bc05-c64f747fe4f2/flashcard utf-8 LF