Departments With at Least One Employee
Easy
Anti & Semi Joins
Return the names of departments that have at least one employee, without returning a department more than once. Order by name.
Table schema
Departments(id INT PRIMARY KEY, name VARCHAR(50))
Employees(id INT PRIMARY KEY, department_id INT)Sample data
Departments: (1, Eng), (2, HR), (3, Legal)
Employees department_ids: 1, 1, 2
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.