w3resource
SQL exercises

SQL Subquery Exercises: Display the details of departments managed by Susan

SQL SUBQUERY: Exercise-53 with Solution

Write a query in SQL to display the details of departments managed by Susan.

Sample table : departments


Sample table: employees


Sample Solution:

SELECT * 
	FROM departments 
	WHERE manager_id IN 
	(SELECT employee_id 
		FROM employees 
			WHERE first_name='Susan');

Sample Output:

department_id	department_name	manager_id	location_id
40		Human Resources	203 		2400

Practice Online


Query Visualization:

Duration:

Query visualization of Display the details of departments managed by Susan - Duration

Rows:

Query visualization of Display the details of departments managed by Susan - Rows

Cost:

Query visualization of Display the details of departments managed by Susan - Cost

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a query in SQL to display all the infromation about those employees who earn second lowest salary of all the employees.
Next: Write a query in SQL to display the department ID, full name (first and last name), salary for those employees who is highest salary drawar in a department.

What is the difficulty level of this exercise?



New Content: Composer: Dependency manager for PHP, R Programming