1
I am creating a database in Mysql and in it there will be a table to do point control: when the employee started working hours, when closed, when stopped for lunch and etc.
I’ve been making a prototype table:
+------------------+---------------------+--------+----------+-------------+
| employee_name | datetime_registered | status | register | observation |
+------------------+---------------------+--------+----------+-------------+
| Fulando da Silva | 2020-10-28 14:49:00 | 0 | 1 | NULL |
+------------------+---------------------+--------+----------+-------------+
Whereas status
is a code that will translate to: start of hours, end of hours and etc. And the backend would have a business rule to make this translation from code to value. I thought this way for memory saving, since storing a string of type 'Start of business' takes more long-term memory than just '0', '1' or '2'.
But I don’t think this is the best practice for it. I researched about it and found nothing directly related to it.
Explaining the rest of the table: the field employee_name
keeps the name of the official, the field datetime_registered
guard the time the office status has been updated, register
is the id of each record, being the primary key of the table, and observation
is a text field that stores some occasional justification, if the employee closes early and needs to justify briefly.