Explain how you would write SQL to solve a self join problem, and describe how you would determine whether two binary trees are identical.
Use the provided employee and tree-node tables. Return reporting pairs and one comparison result for the two trees.
Output
- Reporting rows with
result_type, employee_id, manager_id, employee_name, and manager_name, followed by one tree row with trees_identical.
- Include employees with a non-null manager who matches another employee.
- Order reporting rows by
manager_id, then employee_id, followed by the tree result.