SQL: Do you need an auto-incremental primary key for Many-Many tables?

后端 未结 7 982
半阙折子戏
半阙折子戏 2020-12-06 00:48

Say you have a Many-Many table between Artists and Fans. When it comes to designing the table, do you design the table like such:

ArtistFans
    ArtistFanID         


        
7条回答
  •  一整个雨季
    2020-12-06 01:39

    I cannot think of any reason to use the first form you list. The compound primary key is fine, and having a separate, artificial primary key (along with the unique contraint you need on the foreign keys) will just take more time to compute and space to store.

提交回复
热议问题