title: How to design database table for working hours?
body: <p>Hei guys, I'm trying to help my friend to design database tables. It is for a system tracking workers' working hours in a factory by reading card info from certain card readers. Each time a worker log his in/out information, there would be an record saved. </p>
  
  <p>My problem is, how can I calculate each worker's working time (in minutes), each workday? A worker may work from 8:00AM~20:00PM, or 20:00PM~8:00AM. </p>
  
  <p>Anyone can help me?</p>
  
  <p>Thanks!</p>
  
  <hr>
  
  <p>You guys did give me a lot of help. 
  The previous design is a table with in-record or out-record. It was hard for me to locate which ones belong to the same work-time-span. I now use another table with records both have the in-time and out-time in the same record. Insert to save in-time, update to save out-time, which makes it easy to calculate the total minutes between in-time and out-time.</p>