title: Foreign Keys - What do they do for me?
body: <p>I'm building a small application and setting up foreign key relationships between tables. However I'm confused as to WHY I really need this? What is the advantage - does it assist me when writing my queries that I don't have to perform any joins? Here's an example snippet of my database:</p>
  
  <pre><code>+-------------------+
  | USERS             |
  +-------------------+
  | user_id           |
  | username          |
  | create_date       |
  +-------------------+
  
  +-------------------+
  | PROJECTS          |
  +-------------------+
  | project_id        |
  | creator           |
  | name              |
  | description       |
  +-------------------+
  </code></pre>
  
  <p>There is a key relationship between <code>users</code>.<code>user_id</code> and <code>projects</code>.<code>creator</code></p>
  
  <p>Would I be able to perform a query like so?</p>
  
  <p><code>SELECT * FROM PROJECTS WHERE USERS.username = "a real user";</code></p>
  
  <p>Since MySQL should know the relationship between the tables? If not then what is the real function of Foreign keys in a database design?</p>