Should junction tables have more than one primary keys from another identifying table?

后端 未结 4 629
野趣味
野趣味 2021-01-16 04:43

Here\'s an example: Originally I have 3 tables. Table B references Table A. So now Table B has two primary keys. One used as the original primary key and the other one to en

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-16 05:37

    You can not have more than one primary key. What you have there might be indexes. If the user_id column from table posts is included in your primary key, you can take it out and leave the primary key composed of just the id column.

    I hope this helps

提交回复
热议问题