How to model a database with many m:n relations on a table

后端 未结 5 1290
孤城傲影
孤城傲影 2021-01-02 06:25

I am currently setting up a database which has a large number of many-to-many relations. Every relationship was modeled via a link table. Example:

A person has a num

5条回答
  •  醉酒成梦
    2021-01-02 07:05

    In my humble opinion I would go for the first model. It's probably a more complex model but in the end it will make things easier when you're extracting info from tables and the application code could get dirtier or more unreadable for other programmers. Beside, there are some authors that wouldn't reccommend to use multipurpose tables like that.

    In the end you must go with whatever suits you better. We don't know the whole context so can't help you too much to decide. But, for what you're saying and I'd definitely go for option number one.

提交回复
热议问题