primary key using 2 fiekds like team and name RRS feed

  • Question

  • Hi

    I have tables: hitters, pitchers, 40manroster, Fielding, Positions.  These tables have players with same name on different teams.  How do I do a Primary key or relationship if i can't

    set the Primary key like so: Team and Player.  It needs to be unique right.  I'm confused. Both

    Players are different people.     Can anyone help me.

    Right now I have no Primary key or relationship .           

    example: New York Yankees      Boston Red Sox

                  John Tucker               John Tucker        (same name but different people)

                  Bill Smith                   Roy Hobbs

    Monday, November 26, 2018 12:04 AM


All replies

  • if you use a integer as the primary-key for team table. You can have a player table with a integer as the primacy-key. The player table will have foreign-key integer column the holds the primary-key team record it belongs to.

    You can the have one team record that has many player records tied to it a one to many relationship.


    Monday, November 26, 2018 12:37 AM
  • Give each player a unique ID number that identifies them in all tables. This also overcomes the problem where there are two John Smiths on the same team.
    Monday, November 26, 2018 12:49 AM