List all the employees who have atleast one person reporting to them List the employee details if and only if more than 10 employees are presently in department 10
RE: List all the employees who have atleast one person...
/* * b) List the employee details if and only if more than 10 employees are presently in department 10 */ /*This Query Is More Generic instead of Department 10 it searches for any Department*/ SELECT * FROM Eml WHERE Dpt IN (SELECT CASE WHEN COUNT(Dpt) > 10 THEN Dpt ELSE NULL END FROM Eml GROUP BY Dpt);
RE: List all the employees who have atleast one person reporting to themList the employee details if and only if more than 10 employees are presently in department 10
This query lists all the employees who have atleast one person reporting
select ename cnt from (select ename count(*) over (partition by mgr) cnt from emp order by cnt) where cnt >1;
RE: List all the employees who have atleast one person reporting to themList the employee details if and only if more than 10 employees are presently in department 10
Use the following query. we are just using the same table twice to find the employess who are having some employee under them or they are mgr