Friday, March 23, 2012

Multiple Foreign Keys

I am constructing a db in sql server 2000 that will score cross-country running meets. I have an individual results table that needs to only contain participants that are entered as participants but are specific to a certain race as well. Can I have this table be linked back to TWO other tables via the PK-FK relationship and what issues might I have doing that?

Thanks!yes, you can, and no, there won't be any|||Hai rudy,

If i link a column in one table (say table A) with columns in two different tables(say B and C) using foreign key relation ship, does the columns in both those tables(B and C) should be of the same datatype..?

Thnks in advance|||for the sake of efficiency, i think they should be, however, i have no idea if you can actually link the same column in one table to two different other tables

why don't you try it and see if it works? let us know, thanks|||Thnks rudy, i will try it and let u know what happened...|||I think this is the setup you want. [RaceParticipant] is linked back to [Participant] by a ParticipantID, and to [Race] by a RaceID. ParticipantID and RaceID do not need to be the same datatype, but ParticipantID should be the same datatype in both the [Participant] and [RaceParticipant] tables, and [RaceID] should be the same datatype in both the [Participant] and [RaceParticipant] tables.

...[Participant]\
................[RaceParticipant]
.........[Race]/sql

No comments:

Post a Comment