- An entity set may not have sufficient attributes to form a primary key. Such an entity set is termed as weak entity set.
- An entity that has a primary key is termed as strong entity set.
II. Requirement of weak entity sets:
Consider the following example:
Figure 1: Weak Entity Set
Consider an entity set Payment which has three attributes: payment_no, payment_date and payment_amount. Although each payment entity is distinct but payment for different loans may share the same payment number. Thus, this entity set does not have a primary key and it is an entity set. Each weak set must be a part of one-to-many relationship set. Weak entity set is required for following reasons:
1. To avoid the inconsistencies caused by duplicating the key of the strong entity.
i. Though weak entity set can be converted into strong entity set by simply adding appropriate attributes, this approach results in the redundant storage of primary key.
ii. The primary key of a weak entity set can be inferred from its relationship with the strong entity set. If we add primary key attributes to the weak entity set, they will be present in both the entity set and the relationship set and they have to be the same.
iii. Hence, there will be redundancy in the ER diagram and we lose the concept of dependency.
iv. In the example mentioned above, adding a primary key attribute to the weak entity set Payment results in redundant storing of primary key.
2. Weak entities reflect the logical structure of an entity being dependent on another entity.
i. A member of a strong entity set is called dominant entity and member of weak entity set is called as subordinate entity.
ii. A weak entity set does not have a primary key but we need a means of distinguishing among all those entries in the entity set that depend on one particular strong entity set.
iii. The discriminator of a weak entity set is a set of attributes that allows this distinction to be made. In the example mentioned above, payment_no acts as discriminator for payment entity set. It is also called as the Partial key of the entity set.
iv. The relationship between weak entity and strong entity set is called as Identifying Relationship. In example, loan-payment is the identifying relationship for payment entity.
3. Weak entities can be deleted automatically when their strong entity is deleted.
i. Existence of weak entity set depends on existence of strong entity set.
ii. Thus, deletion of strong entity set results in the deletion of weak entity set. Thus, if a database contains a entity set that depends on another entity set that depends on another entity set, it is necessary to mark them as weak entity set.
iii. Thus, deletion of loan details of customer will result in the deletion of payment information.
iv. Thus, for representation of such types of existent dependent entity sets, weak entity sets are required.
4. Weak entities can be stored physically with their strong entities.
i. For instance, indexes created automatically with the primary key column will store the values of weak entity columns in the consecutive disk locations.
ii. This will lead to faster data retrieval process.