DB Concept": Identifying and Non-Identifying Relationships

本文解析了四种关系类型:标识关系、非标识的可选关系、非标识的强制关系及非特定关系,并探讨了它们如何影响数据模型的设计。文章还讨论了各种关系类型的基数形式及其在生成物理模型时对ForeignKey列的影响。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Relationship Type > Identifying Relationships: Identifying relationships are always mandatory. A foreign key value must exist in the child entity and the foreign key value must be found in the primary key of the parent. Identifying relationships propagate primary keys as primary keys to child entities, which can result in compound keys.
The use of compound keys is often valid and appropriate; however, they limit the flexibility of your data model. When you use a compound key, the data contained in the child entity can only be identified in the context of its parent. If you ever need to use the data independently, then you will have a problem.
The cardinality of a mandatory relationship must be in the form of one-to-something.
When generating a physical model, foreign key columns propagated by a mandatory relationship default to NOT NULL.

Relationship Type > Non-Identifying, Optional Relationships:Non-identifying relationships propagate the parent's primary key to the non-key attributes of the child. Since the relationship is optional the foreign key value is not always required in the child entity; however, if a value does exist, then the foreign key value must be found in the primary key of the parent.
The cardinality of an optional relationship takes the form of zero or one to something.
When generating a physical model, foreign key columns propagated by a optional relationship default to NOT NULL.

Relationship Type > Non-Identifying, Mandatory Relationships:Non-identifying relationships propagate the parent's primary key to the non-key attributes of the child. A foreign key value must exist in the child entity and the foreign key value must be found in the primary key of the parent.
The cardinality of a mandatory relationship must be in the form of one to something.
When generating a physical model, foreign key columns propagated by a mandatory relationship default to NOT NULL.

Relationship Type > Non-Specific Relationships:Non-specific relationships denote many-to-many relationships. Because many-to-many relationships cannot be resolved, non-specific relationships do not propagate any foreign keys. Many-to-many relationships are undesirable and should be removed as you normalize your data model.
The following illustrates a non-specific relationship where the parent and the child are both optional. In the Relationship Editor you can specify whether the parent and the child are optional or mandatory.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值