title: MySQL query for multiple date range check not working
body: <p>Below is my data and query,</p>
  
  <pre><code>academic year start date - 2018-01-01
  academic year end date   - 2018-06-30
  </code></pre>
  
  <p>Term table</p>
  
  <pre><code>term_id    parent_id      start_date          end_date 
  1          null                2018-01-01          2018-01-30
  2          1                   2018-01-01          2018-01-10
  3          1                   2018-01-11          2018-01-20
  4          null                2018-02-01          2018-02-28
  5          4                   2018-02-01          2018-02-10
  6          4                   2018-02-11          2018-02-20
  </code></pre>
  
  <p>I want to add new term which should not be in date range of term_id 1,2 and also in date range of academic year start and end date.
  But in my query it is not working below is my query,</p>
  
  <p>I have entered, it should not entered from below query</p>
  
  <pre><code>start_date - 2018-02-11 
  end_date   - 2018-02-25 
  
  SELECT * from term
  where parent_id=null
  and start_date &gt;= 2018-02-11 
  and end_date &lt;= 2018-02-25
  and start_date &gt;= 2018-01-01(academic year start date)
  and end_date &lt;= 2018-06-30(academic year end date)
  </code></pre>
  
  <p>Same for enter sub term
  it should be in parent term date range and unique in all sub term of same parent term.
  I have entered, which should not enter,</p>
  
  <pre><code>start_date - 2018-02-13
  end_date -2018-02-18
  </code></pre>
  
  <p>My query is below,</p>
  
  <pre><code>SELECT * from term
  where parent_id=4
  and start_date &gt;= 2018-02-13
  and end_date &lt;= 2018-02-18
  and start_date &gt;= 2018-02-01(parent term start date)
  and end_date &lt;= 2018-02-28(parent term end_date)
  and start_date &gt;= 2018-01-01(academic year start date)
  and end_date &lt;= 2018-06-30(academic year end date)
  </code></pre>