zoukankan      html  css  js  c++  java
  • non-identifying and identifying

    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.

    Let’s take a real time example of a book storing system. In the system, a book belongs to an owner, and an owner can own multiple books. But the book can also exist without the owner and it can change the owner. Thus the relationship between a book and an owner is a non-identifying relationship.

    Now suppose one intends to keep a record of chapters included in a book. We know that chapters will only exist when a book exists. Thus the relationship between a book and its chapters is an identifying relationship.

    In database terms, relationships between two entities may be classified as being either identifying or non-identifying. Identifying relationships exist when the primary key of the parent entity is included in the primary key of the child entity. On the other hand, a non-identifying relationship exists when the primary key of the parent entity is included in the child entity but not as part of the child entity’s primary key. In addition, non-identifying relationships may be further classified as being either mandatory or optional. A “mandatory” non-identifying relationship exists when the value in the child table cannot be null. On the other hand, an “optional” non-identifying relationship exists when the value in the child table can be null.

    原文:https://www.datanamic.com/support/relationshiptypes.html

    https://www.vertabelo.com/blog/documentation/defining-identifying-and-non-identifying-relationships-in-vertabelo

  • 相关阅读:
    Java中Collection和Collections的区别(转载)
    equals和==的区别
    【转载】String、StringBuffer与StringBuilder之间区别
    Mybatis实现
    springMVC---文件上传
    java---Map接口实现类
    java---迭代器(Iterator)
    java---泛型
    java---StringBuilder类的用法(转载)
    c#开源项目收集
  • 原文地址:https://www.cnblogs.com/anqiang1995/p/11162823.html
Copyright © 2011-2022 走看看