`

identifying relationship or non-identifying relationship

    博客分类:
  • db
 
阅读更多
   判别一个关系是Non-Identifying还是Identifying只要区分子实体的主键,看是否需要父实体的外键来共同作为主键,需要则为Identifying,如果子实体自己的主键就可唯一标识则它为Non-Identifying!

以下是具体的定义:

ER模型中只允许二元联系,n元联系必须定义为n个二元联系。根据实际的业务需求和规则,使用实体联系矩阵来标识实体间的二元关系,然后根据实际情况确定出连接关系的势、关系名和说明,确定关系类型,是标识关系、非标识关系(强制的或可选的)还是非确定关系、分类关系。

如果子实体的每个实例都需要通过和父实体的关系来标识,则为标识关系,否则为非标识关系。非标识关系中,如果每个子实体的实例都与而且只与一个父实体关联,则为强制的,否则为非强制的。如果父实体与子实体代表的是同一现实对象,那么它们为分类关系。非强制的非标识关系,用带菱形的虚线表示。

—————————–

Identifying and non-identifying relationships An identifying relationship means that the child table cannot be uniquely identified without the parent. For example, you have this situation in the intersection table used to resolve a many-to-many relationship where the intersecting table’s Primary Key is a composite of the left and right (parents) table’s Primary Keys.

Example…
Account (AccountID, AccountNum, AccountTypeID)
PersonAccount (AccountID, PersonID, Balance)
Person(PersonID, Name)

The Account to PersonAccount relationship and the Person to PersonAccount relationship are identifying because the child row (PersonAccount) cannot exist without having been defined in the parent (Account or Person). In other words: there is no personaccount when there is no Person or when there is no Account.

A non-identifying relationship is one where the child can be identified independently of the parent ( Account – AccountType)

Example…
Account( AccountID, AccountNum, AccountTypeID )
AccountType( AccountTypeID, Code, Name, Description )

The relationship between Account and AccountType is non-identifying because each AccountType can be identified without having to exist in the parent table.

You can define the relationship type (identifying/non identifying) in the DeZign for Databases in the relationship dialog. Double click on the relationship line in the diagram window to display the relationship dialog.

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics