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 "non-mandatory". A mandatory non-identifying relationship exists when the value in the child table cannot be null. On the other hand, a non-mandatory non-identifying relationship exists when the value in the child table can be null.
Here's a simple example of an identifying relationship:
Parent
------
ID (PK)
Name
Child
-----
ID (PK)
ParentID (PK, FK to Parent.ID) -- notice PK
Name
Here's a corresponding non-identifying relationship:
Parent
------
ID (PK)
Name
Child
-----
ID (PK)
ParentID (FK to Parent.ID) -- notice no PK
Name
Existence Dependency (Strong vs. Weak Entity). ?
•The MOVIE and MOVIE_COPY example also is a case of existence dependency.
•A Strong Entity is one that exists on its own, independent of other entities.
•A Weak Entity is one whose existence depends on another entity. This means an occurrence of one entity cannot exist unless there is an occurrence of a related entity.
•This modeling situation usually occurs for binary 1:N relationships where the cardinality is mandatory-one for the weak entity.
•The Strong Entity is usually referred to as the Owner or Parent entity, while the Weak Entity is referred to as the Dependent or Child entity.
•Weak entities often do not have a natural identifier (candidate key).
•The primary key of the owner entity is used as part of the primary key of the dependent child entity.
•Note the primary key of the MOVIE_COPY entity is a composite key consisting of the attributes MovieNumber and CopyNumber.
•This situation is also called an identifying relationship. Benefits include:
o1. Data integrity of the existence dependent entity are enforced.
o2. Ease of access for related dependent entities via part of the composite key.
Friday, 8 January 2010
Subscribe to:
Posts (Atom)