SQL Subquery Exercises: Display the department code and name for all departments which located in the city London
SQL SUBQUERY: Exercise-35 with Solution
Write a query in SQL to display the department code and name for all departments which located in the city London.
Sample table: departments
Sample table: locations
SELECT department_id, department_name FROM departments WHERE location_id = ( SELECT location_id FROM locations WHERE city = 'London' );
department_id department_name 40 Human Resources
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a query to display the employee id, name ( first name and last name ), salary, department name and city for all the employees who gets the salary as the salary earn by the employee which is maximum within the joining person January 1st, 2002 and December 31st, 2003.
Next: Write a query in SQL to display the first and last name, salary, and department ID for all those employees who earn more than the average salary and arrange the list in descending order on salary.
What is the difficulty level of this exercise?