title: Another way to write HAVING EVERY and HAVING ANY in Mysql
body: <p>I am trying to find the enames of managers who manage only departments with budgets larger than 1 million, but at least one department with budget less than 5 million</p>
  
  <p>I understand that the query should work like this but can not get it to run in Mysql. Im guessing because Every and Any in the having do not work in mysql. Is there any alternate way to write this? Also here is the schema </p>
  
  <pre><code>Emp(eid: integer, ename: string, age: integer, salary: real) 
  Works(eid: integer, did: integer, pct_time: integer) 
  Dept(did: integer, dname: string, budget: real, managerid: integer)
  </code></pre>
  
  <p>And here is the query:</p>
  
  <pre><code>select 
    e.ename 
  from 
    emp e, dept d 
  where 
    e.eid=d.managerid 
  group by 
    e.eid, e.ename 
  having 
    every(d.budget&gt;1000000) and 
    any(d.budget&lt;5000000); 
  </code></pre>