title: Facebook like notifications tracking (DB Design)
body: <p>I am just trying to figure out how Facebook's database is structured for tracking notifications.</p>
  
  <p>I won't go much into complexity like Facebook is. If we imagine a simple table  structure for notificaitons:</p>
  
  <p><code>notifications (id, userid, update, time);</code></p>
  
  <p>We can get the notifications of friends using:</p>
  
  <pre><code>SELECT `userid`, `update`, `time`
  FROM `notifications`
  WHERE `userid` IN 
  (... query for getting friends...)
  </code></pre>
  
  <p>However, what should be the table structure to check out which notifications have been read and which haven't?</p>