I need your suggestion on how to implement SQL Server table relationships.
I have many customers, each holds a unique id (
customerID
)each customer can have many categories associated (
categoryID
)each customer can have many sub categories (
subCategoryID
) forwhen a customer logs in I know its
CustomerID
,CategoryID
andSubCategoryID
.customer plans in advance how many hours will work every week for the year to come (on december 2014 plans 52 weeks of 2015)
every day a customer reports if they worked or took a day off.
I thought of having a table called WeeklyPlanning
with columns:
CustomerID, CategoryID, SubCategoryID, Year, WeekNumber, WorkingHoursPlan
and another table called DailyWorkingHours
with columns:
Dates, WorkingHours
My questions:
I don't know how to combine these two tables together, use a compound key? (CustomerID, CategoryID, SubCategoryID, Year, WeekNumber
) or maybe generate a unique PK in WeeklyPlanning
that will be used as a FK in DailyWorkingHours
?
I'm looking for the best way to implement this.
thanks