核心数据/数据库实体关系
如果存在两个实体,并且在某种意义上它们具有一对多关系,而在另一种意义上它们具有多对一关系。这 2 种关系是否会成为多对多关系,或者是否可以拥有 2 种关系?一对多,多对一?
If two entities exist and in one sense they have a one to many relationship and in another sense they have a many to one relationship. Do these 2 relationships become a many to many or is it ok to have 2 relationships? One to many, Many to one?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一对多关系,给定您的示例 - 取决于您从关系的哪一侧开始它是一对多(GPS 位置 -> 照片)或多对一(照片 -> GPS 位置) ) - 但这并不意味着它是多对多!
一张照片有唯一一个 GPS 位置,因此您的表格将如下所示......
It's a one-to-many relationship, given your example - depending on which side of the relationship you start from it's one-to-many (GPS location -> photo) or many-to-one (photo -> GPS location) - this doesn't make it a many-to-many, though!
A photo has one-and-only-one GPS location, so your tables would look like this...
在 ER 建模中,两种实体类型之间存在多种关系是很正常且允许的。
In ER modelling it is quite normal and permissable for two entity types to have more than one relatiomship between them.