Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSQLself-joinsSingle-choice MCQ

To find all pairs of employees in the same department without listing each pair twice, what makes this self-join correct?

SELECT a.name, b.name FROM employees a JOIN employees b ON a.dept_id = b.dept_id AND a.id < b.id;