How to handle an “OR” relationship in an ERD (table) design?

后端 未结 2 1817
心在旅途
心在旅途 2021-01-18 17:45

I\'m designing a small database for a personal project, and one of the tables, call it table C, needs to have a foreign key to one of two tables, call them

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-18 18:24

    If you're sure that C will only ever be referring to one of two tables (and not one of N), then your first choice is a sensible approach (and is one I've used before). But if you think the number of foreign key columns is going to keep increasing, this suggests there's some similarity or overlap that could be incorporated, and you might want to reconsider.

提交回复
热议问题