programming-examples/sql/SubqueriesHRDatabase/Write a query in SQL to display the department name and Id for all departments where they located, that Id is equal to the Id for the location.sql

12 lines
434 B
MySQL
Raw Normal View History

2019-11-18 14:05:53 +01:00
/*Write a query in SQL to display the department name and Id for all departments where they located, that Id is equal to the
Id for the location where department number 30 is located.
*/
SELECT department_name, department_id
FROM departments
WHERE location_id =
(
SELECT location_id
FROM departments
WHERE department_id = 30);