Best MySQL Table Structure: 2 Parents, 1 Child

后端 未结 2 1392
情歌与酒
情歌与酒 2021-01-23 18:44

I have two parent tables, BusinessGroup and SocialGroup, and one child table, Members. A Member can belong to either parent, but not both.

As far as I can see, there ar

2条回答
  •  青春惊慌失措
    2021-01-23 18:49

    "parent tables" is probably a misnomer - in the relational model I'd flip your relationship. e.g. make members the master records table, and a join table that allows 1-1 mapping, so have a PK of member_id or whatever the right field is, and map to the FK in either BusinessGroup or SocialGroup.

提交回复
热议问题