-2

So here is my thought process:

If the site only asks users to rate movie in a scale from 1 to 5 than it should be many to many

However if the site allows users to enter more fields like comment, then it should be one to many because comment is customized for every user and it cannot be assigned to other users

Am i right?

4

1 回答 1

0

电影和用户与评论有关系,而不是彼此直接相关。

我应该对用户评论使用多对多还是一对多关系?

因此,要回答这个问题,用户与评论之间是零对多关系,因为他们可能没有评论,而电影与评论之间是零对多关系,因为它可能没有评论。如果您的业务逻辑要求电影有评论或用户至少有一条评论,那么它可以是一对多的。根据这个问题erd-many-vs-zero-or-many-one-or-many-crowfoot-notation ,取决于您的设计有多模糊。下图是电影分级系统的示例 ERD,并显示了这些关系。

电影评论系统的ERD

于 2021-03-17T00:01:25.493 回答