 <p>You can use <strong>Having Clause</strong> in Conjunction with <strong>Group By</strong></p> <pre><code>select ename from emp where sal &gt; any (select avg(sal) from emp group by deptno) having count(*)&gt;4; </code></pre>