Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004
    Location
    Sweden
    Posts
    17

    Question About primary keys - PLEASE HELP

    Hi everyone!

    I'm a newbie and right now I'm getting crazy about the primary keys.

    From what I've heard one doesn't have to use a forreign key as the primary key in a one-to-many relationship if it will not function as a primary key due to the use of the table. For instance in the attached file where I have decided to not use the Employeenumber as a primary key in the WeekSchedule-table. This because the table shall, except from showing which employee who is going to work on which week, day and workshift, also show the emplyees wishes. In other words the table first get filled up with wishes. Later one can choose who is going to work by setting the Allowed variable to TRUE or FALSE.

    Because of that a certain employee can make many wishes - the Emplyeenumber will not be unique. Instead I gave the table a counter, ID, to function as primary key.

    But I don't know if this is the most appropiate approach. I think there will be alot of redundancy beacause of the Allowed variable. An employee can occur infinite many times with ID and Allowed as the only difference. Perhaps I should make two different tables - one for wishes and one for WeekSchedule? Or make a new primary key ut of ID, Employeenumber, Week, Day and Shift?

    It seems like the WeekShedule table in its present form doesn't agree with the second normal form - Am I right?

    PLEASE PLEASE PLEASE help me sort this out...

    Thanks in advance!

    /Marcus

  2. #2
    Join Date
    Apr 2004
    Location
    Sweden
    Posts
    17

    Question Re: About primary keys - PLEASE HELP

    Hmmmn why isn't the picture shown? I'll make another try...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •