title: MySql query to find records NOT between time range
body: <p>I am working on a project where the <code>from</code> and <code>to</code> time are given and I have to find out if any other vehicles are allocated on that time period.</p>
  
  <p>For EG:
  Vehicle 1 is allocated <code>FROM 2017-04-29 10:00:00 TO 2017-04-29 12:00:00</code> in the case table.</p>
  
  <p>My use case: I should not be able to allocate the same vehicle in that time range.</p>
  
  <p>So, How would I check if a vehicle is allocated / clashes with the time range? (IN mySQL)</p>
  
  <p>Here is where I am so far:</p>
  
  <pre><code> SELECT 'vehicle_code' 
   FROM   'case' 
   WHERE  'from_time' &lt;= '2017-04-29 11:00:00'
   AND    'to_time' &gt;= '2017-04-29 13:00:00'
  </code></pre>