title: Why do we need to use Foreign Keys?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/599159/should-i-use-foreign-keys">Should I use foreign keys?</a>  </p>
  </blockquote>
  
  
  
  <p>Ok, let's assume we have two tables, <code>users</code> and <code>comments</code>. In comments we have a column <code>comment_made_by_user_id</code> and it means which user typed that particular comment. Why do we need to specify it as a foreign key? If we don't do that, it will still work. We specify primary keys, because it makes queries faster as far as I know (we need to search only for one row while when we don't have a primary key/index, we have to go through all rows). Is it just a good coding practise?</p>