How to display dname where at least 3 are working and display only department name?

Oracle Apps Interview QuestionsCategory: SQLHow to display dname where at least 3 are working and display only department name?
Questions Master asked 9 years ago

How to display dname where at least 3 are working and display only department name?

1 Answers
Shailender Thallam Staff answered 9 years ago

SELECT DISTINCT d.dname
FROM dept d,
  emp e
WHERE d.deptno=e.deptno
AND 3         >ANY
  (select count(deptno) FROM emp group by deptno
  );