Take these suggestions for what they are - the ramblings of a bored
programmer avoiding the unrewarding tasks on todays agenda.
I may be completely off the mark but your design seems a little
circular and denormalized to me.
Q1. Why separate admin from projects - Combine these into one table --
their column definitions are identical - the ID can be assigned to the
timesheet. Consider adding a column to define the "Type". If you
really want to go crazy - Type can be a domain table all to itself and
the type column would be a number. I didn't do that here but you could
if your type list was determined to be large.
ProjectID ProjectDesc Type
------ ----------- -----------
1 ProjectA Task
2 Vacation Admin
3 ProjectC Task
Customers - Consider NOT including a Problem type in a "Customer"
table. To do so would result in multiple rows per customer. A table
named customers should define a customer.
Customer
CustomerCode Name Address ...
13458 Sea Watch Int'l
Task
TaskID Description
80 Open - Multiple Issues
90 Connectivity
91 Disaster Recovery
92 Performance Tuning
Space and speed are probably not an issue but integers take less space
than names and are much faster to join on.
You can create another table for when a customer engages services for a
specific project. This table would repeat the customer ID much like
your Customers table. Let's call it Engagement
EngagementID EngagementName CustomerCode ...
123 Connection Prob. 13458
Your Employee Table for time tracking - Consider renaming to something
like EmployeeHours or Timesheet
EmpID EngagementID ActivityDate ActivityFrom ActivityTo
TimeSpent TaskID
789 123 9/28/2006 NULL NULL
2 90
NOTE: Depending on the design of your interface, you can inforce input
of activity time from and to
NOTE: Including the TaskID at the timesheet level allows much more
flexibility. What if a customer want you to do 10 things. Are you
going to set up 10 rows in the table that you named "customers" then
have your employees pick from the list. These lists would grow
considerably over time and they would require a lot of time on the part
of team leaders to enter the projects commissioned by customers. This
way you create one engatement and the emp. can charge multiple tasks to
it. If you want to limit the tasks that are available for an
engagment, use another table "EngagementTasks" with the engagmentID and
taskID.
Employee
EmpID EmpName EmpAddress (you could even add some calculated
fields like remaining vacation or sicktimetaken)
789 Bill Chicago 8 40
[quoted text, click to view] Ankith wrote:
> Hi Everyone:
>
> I am trying to come up with a good db design for time tracking an employee's
> time on one of the client projects that I am working on. The background is
> as follows:
>
> 1). An Employee can work on administrative tasks and also some special
> projects.
> 2). An Employee can also work on customer issues.
> 3). If an employee is on a vacation he will not work neither on any projects
> or customer issues.
>
> The tables I have designed so far look like this:
>
> Table 1:
>
> Admin
> ---------
> AdminID
> AdminDesc
>
> The Admin Desc can include: Vacation,General tasks,Sick,Training etc.
>
> Example data
>
> AdminID Desc
> ------ -----
> 1 Vacation
> 2 General
> 3 Sick
> 4 Training
> 5 Time Tracking
>
> Table 2:
> Projects
> ---------
> ProjectID
> ProjectDesc
>
> The Project Desc can include: ProjectA, ProjectB, ProjectC etc.
>
> Example data
>
> ProjectID ProjectDesc
> ------ -----------
> 1 ProjectA
> 2 ProjectB
> 3 ProjectC
> 4 ProjectD
> 5 ProjectE
>
> Table 3:
>
> Customers
> ---------
> CustomerID
> Name
> ProblemType
>
> The Customer Name can include: Customer1, Customer2, Customer3 etc.
> The ProblemTypecan include: DR, Performance, Querytuning etc.
>
> Example data
>
> CustomerID Name ProblemType
> ------ -----
> 1 Customer1 Disaster Recovery
> 2 Customer1 Performance
> 3 Customer2 Backup issue
> 4 Customer3 Query Tuning
>
> Finally My EmployeeTable for Time tracking would be:
>
> Table 4:
>
> Employee
> ---------
> EmployeeID
> EmployeeName
> AdminID
> ProjectID
> CustomerID
> Timespentinhrs
>
> Example Data:
>
> EmployeeID EmployeeName AdminID ProjectID CustomerID Timespentinhrs
> 10 Rob 4 NULL NULL 2
> 10 Rob NULL 2 NULL 10
> 10 Rob NULL NULL 1 25
> 10 Rob NULL NULL 1 10
> 10 Rob NULL NULL 2 3
>
> The total time spent by an employee
> in the above case would be :50
>
> I need to know if this can be designed in a better way? Also How do I track
> the problemtype for an employee for a customer? Also is it a bad idea to
> include the problemtype for the customer in the Employee Table?
>
> please give your thoughts and suggestions.
>
> Thanks
>
> Ankith.