Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2003
    Posts
    114

    Unanswered: 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!

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    yes, you can, and no, there won't be any
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jul 2004
    Location
    Mars
    Posts
    137

    Thumbs up

    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
    Sudar

    --
    My Blog

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    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
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Jul 2004
    Location
    Mars
    Posts
    137
    Thnks rudy, i will try it and let u know what happened....
    Sudar

    --
    My Blog

  6. #6
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    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]/
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

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