Climbing the org chart
Jane Foster runs the store; everyone else reports to someone. Use WITH RECURSIVE to walk the org chart from reports_to: start at the boss (the employee whose reports_to IS NULL, depth 0), descend to her direct reports (depth 1), then theirs (depth 2)... Show id, first_name, last_name, title and depth for all 7 employees, ordered by depth (bosses first), breaking ties by id.
Tables in this exercise
employees
id first_name last_name title city hire_date reports_to