title: SQL group type of query
body: <p>I am using SQL Developer and I have this table structure:</p>
  
  <pre><code>Name           Null     Type         
  -------------- -------- ------------ 
  EMPLOYEE_ID    NOT NULL NUMBER(6)    
  FIRST_NAME              VARCHAR2(20) 
  LAST_NAME      NOT NULL VARCHAR2(25)  
  DEPARTMENT_ID           NUMBER(4)  
  SALARY                  NUMBER(8,2) 
  </code></pre>
  
  <p>What I want to do is print out the <code>department_id</code> which has <strong>AT LEAST</strong> 2 employees with salaries greater than 10000.</p>
  
  <p>I though this would be the query</p>
  
  <pre><code>select department_id
  from employees
  having count(select * from employees where salary &gt; 10000) &gt; 2
  group by department_id;
  </code></pre>
  
  <p>but, from what I found out, you can't put a SELECT statement inside COUNT so now I an stuck and I don't know how else am I supposed to do this query. Any suggestion is welcome.</p>
  
  <p>UPDATE: Please note that I want <strong>AT LEAST</strong> 2 employees to have salary > 10000, not all of them</p>