title: SQL Query: difference in condition in On clause and where clause
body: <p>I am trying to get the difference between below 2 queries</p>
  
  <p><strong>Query 1:</strong></p>
  
  <p>In which I have given condition <strong>'Orders.OrderID != null'</strong> in on clause</p>
  
  <pre><code>SELECT Customers.CustomerName, Orders.OrderID
  FROM Customers
  LEFT JOIN Orders
  ON (Customers.CustomerID=Orders.CustomerID and Orders.OrderID is not null)
  </code></pre>
  
  <p><strong>Query 2:</strong></p>
  
  <p>In which I have given condition <strong>'Orders.OrderID != null'</strong> in where clause</p>
  
  <pre><code>SELECT Customers.CustomerName, Orders.OrderID
  FROM Customers
  LEFT JOIN Orders
  ON Customers.CustomerID=Orders.CustomerID where Orders.OrderID is not null
  </code></pre>
  
  <p>These 2 queries are generating difference results. Why?
  <em>What is the execution flow for where clause and on condition clause?</em></p>
  
  <p>P.S I am using the following link for testing of the queries <a href="http://www.w3schools.com/sql/trysql.asp?filename=trysql_select_join" rel="nofollow">http://www.w3schools.com/sql/trysql.asp?filename=trysql_select_join</a></p>