title: Nested Query or Joins
body: <p>I have heard joins should be preferred over nested queries. Is it true in general? Or there might be scenarios where one would be faster than other:</p>
  
  <p>for e.g. which is more efficient way to write a query?:</p>
  
  <pre><code>Select emp.salary 
  from employee emp    
  where emp.id = (select s.id from sap s where s.id = 111)
  </code></pre>
  
  <p>OR</p>
  
  <pre><code>Select emp.salary     
  from employee emp   
  INNER JOIN sap s ON emp.id = s.id   
  WHERE s.id = 111
  </code></pre>