title: MySQL: Validate for date range within rate range (laravel optional)
body: <p>Hey guys (and girlies)</p>
  
  <p>Can someone point out to validate / search for a date range within a date range? I am using Laravel PHP but raw SQL will be perfect as well.</p>
  
  <p>I want to validate if a date range exists, within a date range. Basically I want a solid validation to avoid overlapping date ranges.</p>
  
  <p>Example (and the concept I have at the moment) (laravel syntax)</p>
  
  <p><code>-&gt;where('start_date','&gt;=',$myrange_start)</code>
  <code>-&gt;where('start_date','&lt;=',$myrange_end)</code></p>
  
  <p>Which will validate for for a start date in the database between the date range</p>
  
  <p>and</p>
  
  <p><code>-&gt;where('start_end','&gt;=',$myrange_start)</code>
  <code>-&gt;where('start_end','&lt;=',$myrange_end)</code></p>
  
  <p>Which will validate for for an end date in the database between the date range</p>
  
  <p>And which has also kind of worked for me is</p>
  
  <p><code>-&gt;whereRaw('? between start_date and end_date', [$today])</code></p>
  
  <p>however, what I want to achieve is to say something like</p>
  
  <p><code>-&gt;whereRaw('? between start_date and end_date', [$myrange_start, $myrange_end])</code></p>
  
  <p>so see if there are date ranges which</p>
  
  <p>a) start: on start, between start and end, on end
  b) start: on end
  c) end: on start, between start and en, on end
  d) start BEFORE start date and ends AFTER ends date
  e) start AFTER start date and ends BEFORE end date</p>
  
  <p>Is this possible?</p>