Many-to-Many relationships needing an associate table

前端 未结 6 538
萌比男神i
萌比男神i 2021-01-25 10:18

In many database design tutorials/articles, they always bring up the fact that if two tables share a many-to-many relationship, then a third table should be created to act as an

6条回答
  •  醉酒成梦
    2021-01-25 11:16

    If you don't create a third table, there is simply nowhere to store the relations.

    With a one-to-one or one-to-many relation, you can store the relation in one of the tables. With a many-to-many relation you have to store the relations separately. (Well, theoretically you could store it as a comma separated list of identities in both tables, but that would be a nightmare to use and to maintain.)

提交回复
热议问题