Problem Statement
What is a practical use of a SELF JOIN?
Explanation
Self joins let you relate a row to another row in the same table via a relationship like manager_id or previous_id.
Alias the table twice so each role is clear. Add indexes on the linking columns for speed.
Code Solution
SolutionRead Only
SELECT e.name AS emp, m.name AS mgr FROM employees e LEFT JOIN employees m ON m.id = e.manager_id;
