SQL Subquery Exercises: Find the names of departments with more than two employees are working
SQL SUBQUERY: Exercise-38 with Solution
38. Write a query in SQL to find the names of departments with more than two employees are working.
Sample table: emp_department
Sample table: emp_details
SELECT dpt_name FROM emp_department WHERE dpt_code IN ( SELECT emp_dept FROM emp_details GROUP BY emp_dept HAVING COUNT(*) >2 );
Contribute your code and comments through Disqus.
Previous: Write a query in SQL to find the departments which sanction amount is larger than the average sanction amount of all the departments.
Next: Write a query in SQL to find the first name and last name of employees working for departments which sanction amount is second lowest.
What is the difficulty level of this exercise?