title: Postgresql: How to relate data between two tables?
body: <p>I've searched this question for Postgresql 9.3 and seen no solutions with adequate answers. The Psql documentation also wasn't helpful.</p>
  
  <p>Say I have two tables:</p>
  
  <ul>
  <li>users (username, password, id) </li>
  <li>data (title, description, id)</li>
  </ul>
  
  <p>I've created a foreign key, but I'm not exactly clear on how that works. I want users to be able to see and edit their data and I want the data to be related to the user. It's the kind of thing we see all the time on blogs or facebook or twitter. </p>
  
  <p>How do I create a relationship between the tables so that each piece of data a user submits is associated with them? </p>