• 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

  • 相关阅读:
    cocos2d-x 屏幕坐标系和OPenGL坐标系转换
    cocos2d-x 判断系统语言
    cocos2d-x 动画加速与减速
    高性能网络服务器编程:为什么linux下epoll是最好,Netty要比NIO.2好?
    Netty学习三:线程模型
    java NIO原理及实例
    java多线程系列(四)---ReentrantLock的使用
    Java并发之AQS详解
    微服务踩坑之边界
    设计模式:观察者模式(有利于代码解耦)
  • 原文地址:https://www.cnblogs.com/anqiang1995/p/11162823.html
Copyright © 2020-2023  润新知