July 5, 2022 at 11:48 am
Hi,
I have this list of training courses:
Course_Code|Description
1 |Health and Safety
2 |cusomter relations
3 |IT training
9 |None
Thanks.
I have this scenario:
A worker may attend up to 4 training courses per year.
I need to design a table "WorkersCourses" where I can enter multiple records per worker.
This will need to be keyed on the workerID & the year as these entries will be different for each year.
Thanks.
July 5, 2022 at 1:13 pm
Quick question, do you really want to hard code the number of courses per time period rather than have it configurable in the data?
😎
July 5, 2022 at 4:09 pm
Hi Eirikur,
No, I don't want to hard code it. Maybe my question wasn't clear. I re-wrote it slightly different.
Thank you.
July 5, 2022 at 7:06 pm
The table would need to contain, and be keyed on, workerID, year and Course_Code. This should be a unique key if that is your rule (that is, no single worker can take the same course twice in a single year).
You would need to use a trigger to ensure that no more than 4 courses per year are allowed in the table for any specific worker.
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
July 6, 2022 at 5:28 am
Take a look at my answer to your previous related question
https://www.sqlservercentral.com/forums/topic/which-table-design-is-better#post-4059010
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply