Designing a table

  • 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.

    • This topic was modified 3 years, 2 months ago by Johnson330.
  • Quick question, do you really want to hard code the number of courses per time period rather than have it configurable in the data?

    😎

     

     

     

  • 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.

  • 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".

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply