If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Applications & Tools > About primary keys - PLEASE HELP

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-22-04, 06:41
knackemacke knackemacke is offline
Registered User
 
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
Reply With Quote
  #2 (permalink)  
Old 04-22-04, 06:43
knackemacke knackemacke is offline
Registered User
 
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...
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On