title: SQL Nested Query Processing
body: <p>Suppose a Nested query is like :</p>
  
  <pre><code>SELECT * 
  FROM Table1 
  WHERE Table1.val in 
  (
     Select Table2.val 
     from Table2 
     where Table2.val&gt;3
  )
  </code></pre>
  
  <p>So my question is how do actual query processors evaluate this - </p>
  
  <ul>
  <li>Do they first evaluate inner most query, store the result temporarily and then use it in the upper level query? [ If the result of subquery is large, temporary storage may not be enough ]</li>
  <li>Or do they evaluate the outer query for each result of the outer query [ requires too many evaluations of outer query]</li>
  </ul>
  
  <p>Am I missing something, and which way is it actually implemented ?</p>