Designing a table

  • Hi,

    I have this list of training courses:

    1 |Health and Safety
    2 |cusomter relations
    3 |IT training
    9 |None


    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.


    • This topic was modified 1 month, 1 week 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) "Money can't buy you happiness." Maybe so, but it can make your unhappiness a LOT more comfortable!

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

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