I have one table called Player
- PlayerID (PK)
- More columns
I want to create another table that has a 1 to 1 relationship to Player named PlayerExtraInfo to contain some columns. So I have several options:
-
Instead of creating a new table, add PlayerExtraInfo columns to Player table
-
Create PlayerExtraInfo table and have a FK in Player table.
Player table
- PlayerID (PK)
- More columns
- PlayerExtraInfoID (FK)
PlayerExtraInfo table
- PlayerExtraInfo (PK)
- More columns
-
The opposite: PlayerExtraInfo contains a FK to Player table. To get sure that relationship remains 1 to 1 I add a unique constrain.
Player table
- PlayerID (PK)
- More columns
PlayerExtraInfo table
- PlayerExtraInfo (PK)
- More columns
- PlayerID (FK, Unique)
-
Similar to option 3 but mixing PK and FK in one. In this case my foreign key becomes also the primary key:
Player table
- PlayerID (PK)
- More columns
PlayerExtraInfo table
- PlayerID (PK, FK)
- More columns
I know that options 1, 2 are correct, but due to performance problems I am option for option 3 or 4. And thinking about these 3 and 4 options some doubts about option 4 assault me:
So my questions are:
- Are options 3 and 4 correct?
- Does option 4 break any normal form?
- Is there another option I didn’t think about?
When extending one table with another one it is absolutely fine (and recommended as well) to use the primary key as the foreign key.