title: Processing of SQL
body: <p>I have a question regarding the processing of SQL code. Which of the following program is more efficient? Or is it same?</p>
  
  <p>My understanding - the second program is more efficient as it subsets data before join</p>
  
  <pre><code>select a.custid, b.ref_date,b.status
  from customertable a
  left join accounts b
  on a.custid = b.custid
  where '2015-01-01' &lt;= b.ref_date &lt;= '2016-01-01'
  
  select a.custid, b.ref_date,b.status
  from customertable a
  left join (select * from accounts
  where '2015-01-01' &lt;= ref_date &lt;= '2016-01-01') b
  on a.custid = b.custid
  </code></pre>