title: What is the difference between these two LINQ Queries and how to correctly optimize them?
body: <p>I have a Clients table which has the following columns:
  Id, FirstName, LastName, CurrencyId, Gender.</p>
  <p>I want to select the client's Currency that corresponded to Id 10 so I am doing something like this:</p>
  <pre><code>var currencyId = Db.Clients.FirstOrDefault(c=&gt;c.Id == 10)?.CurrencyId;
  </code></pre>
  <p>Does this line bring all properties from Db and selects the currency in the code or it executes something like this in the database:</p>
  <pre><code>SELECT currencyId FROM Client WHERE ID = 10
  </code></pre>
  <p>Or I should write the linq like this:</p>
  <pre><code>var currencyId = Db.Clients.Where(c=&gt;c.Id == 10).Select(c=&gt;c.CurrnecyId).FirstOrDefault();
  </code></pre>
  <p>What's the difference between the two queries?
  And what is the correct way to translate the above SQL query into a linq query?</p>