SQL - Advanced Joins
You have a
departments table with columns id, name, and parent_id. Write a query to list each department with its top-level ancestor department name (the highest parent in the hierarchy). Which approach is correct?