title: SQL finding overlapping of times pass midnight (across 2 days)
body: <p>I know there are lots of these types of questions, but i didn't see one that was similar enough to my criteria. So i'd like to ask for your help please. The fields i have are just start and end which are of time types. I cannot involve any specific dates in this. If the time ranges don't go pass midnight across day, i'd just compare two tuples as such:</p>
  
  <pre><code>end1 &gt; start2 AND start1 &lt; end2
  </code></pre>
  
  <p>(end points touching are not considered overlapped here.)</p>
  
  <p>But when I involve time range that pass (or at) midnight, this obviously doesn't work. For example, given:</p>
  
  <pre><code> start  |   end
  --------+--------
  06:00PM | 01:00AM
  03:00PM | 09:00PM
  </code></pre>
  
  <p>Without involving dates, how can i achieve this, please. My assumption is, if end is less than start, then we're involving 2 days. </p>
  
  <p>I'm trying to do this in plain standard SQL, so just a simple and concise logic in the WHERE clause.</p>
  
  <p>Thank you everyone!</p>
  
  <hr>
  
  <p>Added:</p>
  
  <p>Also, how would I test if one time range completely envelopes another? thanks again!</p>