MySQL self join examples
Let’s take a look at the employees table in the sample database.
In the employees table, we store not only employees data but also organization structure data. The reportsto column is used to determine the manager ID of an employee.