programming-examples/sql/SubqueriesHRDatabase/Write a subquery that returns a set of rows to find all departments that do actually have one or more employees assigned to them.sql
2019-11-18 14:05:53 +01:00

8 lines
287 B
SQL

/*Write a subquery that returns a set of rows to find all departments that do actually have one or more employees assigned to them.
*/
SELECT department_name
FROM departments
WHERE department_id IN
(SELECT DISTINCT(department_id)
FROM employees);