title: Check Date between two date columns from two dates SQL Server
body: <p>I want check date between two dates the record is available or not</p>
  
  <p>Here is the table:</p>
  
  <p><strong>Table1</strong>:</p>
  
  <pre><code>S.No    StartDate         EndDate
  -------------------------------------
  1.      15/10/2018        20/10/2018
  2.      10/10/2018        13/10/2018
  3.      21/10/2018        25/10/2018
  </code></pre>
  
  <p>I need the Output</p>
  
  <p><strong>Five Conditions:</strong></p>
  
  <ol>
  <li><p>within the date E.g. 17/10/2018 - 19/10/2018</p>
  
  <pre><code>S.No    StartDate         EndDate
  -------------------------------------
   1      15/10/2018        20/10/2018
  </code></pre></li>
  <li><p>out of the date E.g. 14/10/2018 - 21/10/2018</p>
  
  <pre><code>S.No    StartDate         EndDate
  -------------------------------------
   1      15/10/2018        20/10/2018
   3      21/10/2018        25/10/2018
  </code></pre></li>
  <li><p>Previous from start date E.g. 13/10/2018 - 16/10/2018</p>
  
  <pre><code>S.No    StartDate         EndDate
  -------------------------------------
   1      15/10/2018        20/10/2018
   2      10/10/2018        13/10/2018
  </code></pre></li>
  <li><p>Next from start date E.g. 17/10/2018 - 20/10/2018</p>
  
  <pre><code>S.No    StartDate         EndDate
  -------------------------------------
    1      15/10/2018        20/10/2018
  </code></pre></li>
  <li><p>another date E.g. 17/11/2018 - 21/11/2018</p>
  
  <pre><code>No records
  </code></pre></li>
  </ol>
  
  <p>Here is my idea and my query</p>
  
  <pre><code>SELECT * 
  FROM Table1 
  WHERE 
      CONVERT(DATE, '15/10/2018', 103) BETWEEN StartDate 
                                            AND EndDate 
      AND CONVERT(DATE, '20/10/2018', 103) BETWEEN StartDate  
                                               AND EndDate
  </code></pre>
  
  <p>Thanks in advance</p>