0

I just need some clarification or suggestion about a certain database table. It has the following fields; -ID (PK) -employeeID (FK) -date -timeIn -timeOut

This table stores the daily time in and time out of employees. Now, I have read that all tables shall have a primary key that uniquely identifies a record.. but

can't it actually be without the "ID" for I see no use for it, if I need the certain attendance of a certain someone at a certain date I can just use the "employeeID" field as well as its date.

Are there any suggestions for the table or am I just overthinking it and is fine as it is?

1 Answers1

0

Your reasoning is sound.

Two thoughts:

  • While primary keys can be composite keys (i.e. have more than one column), many people like to have single column primary keys (which are then most often "surrogate keys" based on an artificial counter devoid of any "business meaning"). That does make things easier if code using the database can assume that a simple string or number always identifies a record. See this thread for a discussion.

  • Maybe you want to support people clocking in and out more than once a day.

Thilo
  • 257,207
  • 101
  • 511
  • 656