How can we find employees outside a set of selected departments?
NOT IN subqueries exclude records whose foreign key appears in the subquery's result set.
Excluding specific business units, filtering out blacklisted accounts, non-member lookups.
SELECT name
FROM employees
WHERE department_id NOT IN (
SELECT department_id
FROM departments
WHERE department_name IN ('HR', 'Finance')
);Practice typing production-grade SQL code for NOT IN Subquery.