title: What is a good way to design a table with relationship between users?
body: <p>I'm currently working on a social networking site. (Yeah, I know, there's a whole bunch of them. I'm not trying to make Facebook all over)</p>
  
  <p>I was wondering if anyone could tell me if my way of thinking is way off, or if it is the way it is actually done.</p>
  
  <p>I want a user to be able to have friends. And, for that, I'm thinking that I should have one usertable like so:
  USER</p>
  
  <ul>
  <li>uId</li>
  <li>userName</li>
  <li>email</li>
  <li>etc..</li>
  </ul>
  
  <p>This should probably be a 1:N relationship, so I'm thinking that a table "contacts" should hold a list of users and their friends like so:
  CONTACTS</p>
  
  <ul>
  <li>uId (From USER)</li>
  <li>FriendId (From USER table)</li>
  <li>Friendship type ENUM[Active, Inactive, Pending]</li>
  </ul>
  
  <p>Would it be an effective solution to sort this table on uId, so that a query result would look something similar to this: <br>
  uID    |    friendId<br>
  1      |    2 <br>
  1      |    6 <br>
  1      |    97 <br>
  75     |    1 <br>
  75     |    34 <br></p>
  
  <p>etc</p>
  
  <p>Or are there any different solutions to this?</p>