How can we find employees working in departments located in New York?
The IN subquery checks whether a foreign key matches any ID returned by a secondary query.
Location-based filtering, customer segment filtering, dynamic category inclusion.
SELECT name
FROM employees
WHERE department_id IN (
SELECT department_id
FROM departments
WHERE location = 'New York'
);Practice typing production-grade SQL code for IN Subquery.