Self Join Employees Table for Dates

Find employees who joined after their manager.

sql

SELECT e.name FROM employees e JOIN employees m ON e.manager_id = m.id WHERE e.joined_at > m.joined_at;

This query performs a self-join on the "employees" table to compare the "joined_at" date of each employee with the "joined_at" date of their respective manager, returning the names of those who joined later.

PromptDB can make mistakes. Please double-check responses.