Use self-joins to navigate hierarchical relationships in a single table
HR asked for a clean org report: every employee with their manager's name alongside. Show the employee name, their title, their manager's name, and the manager's title. Include everyone — even me, though my 'manager' situation is a bit circular. Sort by manager last name, then employee last name.
Each hint you reveal reduces the XP you can earn. Try the query first.
Self-join: JOIN dim_employees AS mgr ON e.manager_id = mgr.employee_id
The CEO's manager_id points to herself — a self-referencing record. A regular JOIN will still work; she'll show up as her own manager.
Use LEFT JOIN if you want to include employees whose manager_id might be NULL (though in this dataset, even the CEO has a manager_id)