What is a self join?
Model answer
Joining a table to itself using two aliases, for example finding each employee's manager: SELECT e.name, m.name FROM employees e LEFT JOIN employees m ON e.manager_id = m.id.
Learn this topic
SQL JOINs: INNER JOIN and LEFT JOIN Explained in the course SQL for Beginners: Learn Databases Step by Step.
Sign in to add your own answer.
More questions
- What is a join, and what types are there?
- What is the difference between INNER JOIN and LEFT JOIN?
- How do you find rows in one table that have no match in another?
- What is a CROSS JOIN?
- Why does a missing join condition create duplicate or huge results?
- What is the difference between putting a condition in ON and in WHERE for a LEFT JOIN?