title: SQL database design for multiple rooms check in and check out times for multiple employees
body: <p>I'm working on a web app that tracks workers check in and check out times to certain rooms. I have multiple employees, multiple rooms, and check in and check out times for each room.  Everytime a worker enters or leaves a room, they scan a QR code that has an ID variable in a URL for that room; I need to record the room, date/time, the employee name, and if it was in or out.</p>
  
  <p>One way is to make one table like:</p>
  
  <blockquote>
    <p><strong>Room | Employee | Time | InOrOut |</strong></p>
  </blockquote>
  
  <p><em>The data will be entered into database like:</em></p>
  
  <pre><code>Mens Room, Joe, 6/29 7:30, In
  
  Womens Room, John, 6/29 7:35, In
  
  Mens Room, Joe, 6/29 8:00, Out
  
  Womens Room, John, 6/29 8:05, Out
  </code></pre>
  
  <p><em>And I want to view it like:</em></p>
  
  <pre><code>Mens Room, Joe, 6/29 7:30, In
  
  Mens Room, Joe, 6/29 8:00, Out
  
  Womens Room, John, 6/29 7:35, In
  
  Womens Room, John, 6/29 8:05, Out
  </code></pre>
  
  <p>I want to view data ordered by check in time, but have the following row be the next check out time for that room.</p>