title: MySQL: Excluding some rows from the result?
body: <p>Consider the following table of consultant unavailabilities </p>
  
  <pre><code>c_id | start_date           |end_date
  ---------------------------------------------
  937  | 2018-06-01 13:00:00  | 2018-06-01 20:00:00
  937  | 2018-04-28 08:00:00  | 2018-04-28 18:00:00
  938  | 2018-06-28 14:00:00  | 2018-06-28 16:00:00
  938  | 2018-06-16 14:00:00  | 2018-06-16 17:00:00
  939  | 2018-05-05 09:00:00  | 2018-05-05 12:00:00
  939  | 2018-06-08 12:00:00  | 2018-06-08 16:00:00
  </code></pre>
  
  <p>Now I want to get the consultants available on June the 16th from 09:00 to 18:00<br>
  This is what I have so far:</p>
  
  <pre><code>SELECT c_id, start_date, end_date 
  FROM consultant_unavailabilities 
  WHERE start_date NOT BETWEEN '2018-06-16 09:00:00' AND '2018-06-16 18:00:00' 
  AND end_date NOT BETWEEN '2018-06-16 09:00:00' AND '2018-06-16 18:00:00' 
  GROUP BY c_id
  </code></pre>
  
  <p>which returns: </p>
  
  <pre><code>937  | 2018-06-01 13:00:00  | 2018-06-01 20:00:00
  938  | 2018-06-28 14:00:00  | 2018-06-28 16:00:00
  939  | 2018-05-05 09:00:00  | 2018-05-05 12:00:00 
  </code></pre>
  
  <p>937 and 939 are ok, but 938 is not available. </p>
  
  <p>The trick would be to ask MySQL not to get the ids which have a row of unavailabilitie on June the 16th from 09:00 to 18:00. </p>
  
  <p>How can I achieve that ? </p>