Re: Time keeping in DB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 05 Aug 2009 22:18:31 +0300, Shawn McKenzie <nospam@xxxxxxxxxxxxx> wrote:

So, obviously not PHP related, but I'm looking for thoughts on the best
way to record time sheets in a DB.  A time sheet for hours worked per
day, not like a time clock where you start and stop.

The two possibilities that I have thought of are (these are simplistic,
of course I'll be storing references to the user, the project code etc.):

1. One record for each 7 day week (year, week_num, d1, d2, d3, d4, d5,
d6, d7) where the dX field holds the hours worked
2. One record for each day (date, hours)


In simpliest scenarios, it is better to use first approach.
it is best in terms of simplicity, usage, space consumption.

in case if you need to store extra information about hours (at which location, at which time started, etc, ), then it might be better to split it to following tbles:

1. Time sheet.
All basic information about sheet: user, year, week number, etc. whatever you need.
Just add unique id of this timesheet
Here you can also add cached version of hours per day.

2. Day information:
timesheetId, dayId(1-7),  hours, a lot of extra fields for this day.

Of course, this is applicable only if you have a lot of extra information for each day.
If not, then use easiet approach.






--

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux