无法确定身份关系或身份关系 [英] Trouble deciding on identifying or non-identifying relationship

查看:104
本文介绍了无法确定身份关系或身份关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了以下问题:身份和非身份关系?

I've read this question: What's the difference between identifying and non-identifying relationships?

但是我还是不太确定... 我只有三个表.

But I'm still not too sure... What I have is three tables.

  1. 用户
  2. 对象
  3. 图片

用户可以拥有许多对象,也可以为每个对象张贴许多图片. 我的直觉告诉我,这是一种确定的关系,因为在对象表中需要userID,在图片表中需要objectID ...

A user can own many objects and can also post many pictures per individual object. My gut feeling tells me this is an identifying relationship, because I'll need the userID in the objects table and I'll need the objectID in the pictures tables...

还是我错了?另一个主题中的解释只限于对数据库进行编码后对其进行解释的理论解释,而不是对象在现实生活中的连接方式.在考虑如何构建数据库时,我对如何做出确定与不确定的决定感到困惑.

Or am I wrong? The explanations in the other topic limit themselves to the theoretical explanation of the way the database interprets it after it's already been coded, not how the objects are connected in real life. I'm kinda confused as to how to make the decision of identifying versus non-identifying when thinking about how I'm going to build the database.

推荐答案

两者听起来都像是在识别与我的关系.如果您听说过一对一或一对多以及多对多的术语,则一对一关系识别关系多对多关系非识别关系.

Both sound like identifying relationships to me. If you have heard the terms one-to-one or one-to-many, and many-to-many, one-to- relationships are identifying relationships, and many-to-many relationships are non-identifying relationships.

  • 如果孩子标识了其父级,则这是一个标识关系.在给定的链接中,如果您有电话号码,则知道它属于谁(仅属于一个).

  • If the child identifies its parent, it is an identifying relationship. In the link you have given, if you have a phone number, you know who it belongs to (it only belongs to one).

如果孩子没有识别其父母,则为非身份关系.在链接中,它提到了状态.可以将状态视为代表情绪的表格中的一行. 快乐"并不能识别特定的人,但可以识别许多人.

If the child does not identify its parent, it is a non-identifying relationship. In the link, it mentions states. Think of a state as a row in a table representing mood. "Happy" doesn't identify a particular person, but many people.

编辑:其他现实示例:

  • 物理地址是一种不确定的关系,因为许多人可能居住在一个地址上.另一方面,(通常认为)电子邮件地址是一种识别关系.
  • 社会安全号码是一种识别关系,因为它仅属于一个人
  • 对YouTube视频的评论正在识别关系,因为它们仅属于一个视频.
  • 一幅画的原件只有一个拥有者(可识别),而许多人可能拥有这幅画的转载(不可识别).

这篇关于无法确定身份关系或身份关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆