title: Entity framework Include command - Left or inner join?
body: <p>As I was investigating the difference between <code>Include</code> and <code>Join</code> I found that : </p>
  
  <p>If the DB <em>does not</em> include a Foreign Keys -it has no navigation props so it's better to use <code>Join</code></p>
  
  <p>If It <em>does</em> have a  navigation props - then use <code>Include</code>. ( it also save a db hit.)</p>
  
  <p>But one <a href="https://stackoverflow.com/a/12284852/859154"><strong>answer here</strong></a> caught my attention: </p>
  
  <blockquote>
    <p>Include is implemented as a join. <strong>Depending on the nullability</strong> of the
    included link it is an <strong>inner</strong> or <strong>left</strong> join.</p>
  </blockquote>
  
  <p><strong>Question :</strong> </p>
  
  <p>How does the nullity affects the left / inner join ? </p>
  
  <p>In Sql server I can have a <code>Cities</code> table  and <code>Persons</code> table and a person can have a <code>NULL</code> <code>CityID</code>.</p>
  
  <p><strong>Why</strong> does entity Framework decides for me what kind of join it is ?</p>
  
  <h1>edit :  visualization :</h1>
  
  <p><img src="https://i.stack.imgur.com/wMFGL.png" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/I6dYU.png" alt="enter image description here"></p>
  
  <p>Now lets change CityId to not null : </p>
  
  <p><img src="https://i.stack.imgur.com/Y5KaM.png" alt="enter image description here"></p>
  
  <p>And here is the change : </p>
  
  <p><img src="https://i.stack.imgur.com/ZrOr1.png" alt="enter image description here"></p>