title: Facebook database design?
body: <p>I have always wondered how Facebook designed the friend &lt;-> user relation.</p>
  
  <p>I figure the user table is something like this:</p>
  
  <pre><code>user_email PK
  user_id PK
  password 
  </code></pre>
  
  <p>I figure the table with user's data (sex, age etc connected via user email I would assume). </p>
  
  <p>How does it connect all the friends to this user?</p>
  
  <p>Something like this?</p>
  
  <pre><code>user_id
  friend_id_1
  friend_id_2
  friend_id_3
  friend_id_N 
  </code></pre>
  
  <p>Probably not. Because the number of users is unknown and will expand.</p>