One table in two roles
An employee and their manager are both stored in employees. To show them in one row, do not duplicate data: give the table two aliases and join the relationship.
A self-join is an ordinary JOIN using two aliases for one table. Each alias plays a role; the foreign key links them.
- One table in two roles
- A self-join is an ordinary JOIN using two aliases for one table. Each alias plays a role; the foreign key links them.