数据基数
我对 0:M 关系感到困惑。
所以,我想问一下。
假设我们有 2 个表:
Contact,其属性如下:ContactID(PK)、 名称
地址,具有以下属性:AddressID(PK), 描述, ContactID(FK to Contact, Nullable, Not Unique)
我的说法是否正确:
当联系人中有 1 行且其 ContactID 未出现在地址中时,就会发生 0:M 关系。
要建立 0:M 关系,表地址中的列 ContactID 必须可为空。
提前致谢
I'm confusing about 0:M relationship.
So, I want to ask about that.
Assumes we have 2 tables :
Contact which has attributes like : ContactID(PK),
Name
Address which has attributes like : AddressID(PK),
Desc,
ContactID(FK to Contact, Nullable, Not Unique)
Is my statement right that :
The 0:M relationship occurred when there is 1 row in Contact and it's ContactID don't appear in Address.
To make the 0:M relationship Column ContactID in Table Address must be nullable.
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
0:M
表示法用于注释关系的一侧,指示其基数。它是一个范围,并且在关系的每个实例中都是准确的。当地址中没有出现 ContactID 时,基数为 0。外键不需要为空,一般情况下也不应该为空。当 ContactID 出现在“联系人”而不是“地址”中时,0 情况仍然会发生。
The
0:M
notation is used to annotate one side of a relationship, indicating its cardinality. It is a range and is accurate in every instance of the relationship. When ContactID doesn't occur in address, the cardinality is 0.Foreign keys don't need to be nullable, and shouldn't in general. The 0 case still happens, when a ContactID occurs in Contact and not Address.