Agents hired before their manager

easySQL~10 min · 4 tests · helpdesk

Some agents have been at the help desk longer than the person they report to. HR wants the list.

In agents, manager_id points at another row in the same table. Managers themselves have a NULL manager_id and should not appear in the output.

An agent counts if their hired_date is strictly earlier than their manager’s. Hired on the same day doesn’t count.

Return one row per such agent:

column type meaning
agent_id integer the agent
agent_name text the agent’s name
manager_name text their manager’s name

Row order doesn’t matter.

Tables: agents.

Learn the ideaRead the lesson →
solution.sqlDuckDB · helpdesk

Press ⌘ ↵ or Run to check the visible tests. Submit runs the hidden ones too. Everything runs in your browser.

⌘ ↵ to run