title: Speeding up a SQL query with indexes
body: <p>I have a table called <code>Products</code>.</p>
  
  <p>This table contains over 3 million entries. Every day there are approximately 5000 new entries. which only happens during the night in 2 minutes.</p>
  
  <p>But this table gets queried every night maybe over 20 000 times with this query. </p>
  
  <pre><code>SELECT Price 
  FROM Products 
  WHERE Code = @code 
    AND Company = @company 
    AND CreatedDate = @createdDate
  </code></pre>
  
  <p>Table structure:</p>
  
  <pre><code>Code          nvarchar(50)
  Company       nvarchar(10)
  CreatedDate   datetime
  </code></pre>
  
  <p>I can see that this query takes about a second to return a result from <code>Products</code> table. </p>
  
  <p>There is no <code>productId</code> column in the table as it is not needed. So there is no primary key in the table.</p>
  
  <p>I would like to somehow improve this query to return the result faster.</p>
  
  <p>I have never used indexes before. What would be the best way to use indexes on this table?</p>
  
  <p>If I provide a primary key do you think it would speed up the query result? Keep in mind that I will still have to query the table by providing 3 parameters as </p>
  
  <pre><code>WHERE Code = @code 
    AND Company = @company 
    AND CreatedDate = @createdDate. 
  </code></pre>
  
  <p>This is mandatory.</p>
  
  <p>As I mentioned that the table gets new entries in 2 minutes every day during the night. How would this affect the indexes?</p>
  
  <p>If I use indexes, which column would be the best to use and whether I should use clustered or non-clustered indexes?</p>