programming-examples/sql/SubqueriesHRDatabase/Write a query to find out which employees have a manager who works for a department based in the US.sql

15 lines
437 B
MySQL
Raw Normal View History

2019-11-18 14:05:53 +01:00
/*Write a query to find out which employees have a manager who works for a department based in the US.
*/
SELECT first_name,last_name FROM employees
WHERE manager_id IN
(SELECT employee_id
FROM employees
WHERE department_id IN
(SELECT department_id
FROM departments
WHERE location_id IN
(SELECT location_id
FROM locations
WHERE country_id='US')));