Differentiate between Weak and Strong entity
We have learned about the Entity, Entity type, and Entity set. An entity type can be a student, car etc. which usually have a unique number or value through which they can be identified distinctly. But, there are many other entity types like a Loan(taken by a customer), Apartment(in a building) which may not have enough attributes that can be used to uniquely identify them. For example, loans can't be differentiated from one another if we don't have a customer name. So, in these cases, we might take help from the owner entity(like a customer) so that they help in identifying the data of the dependent entity (like Loan). These are called weak entities.
In this blog, we will understand how to identify these types of entities and how to uniquely differentiate between them. So, let's get started.
A strong entity is an entity type whose existence doesn't depend on any other entity. Strong entity types have a key attribute. The key attribute helps in identifying each entity uniquely. It is represented by a rectangle. A relationship between two strong entities is represented by a diamond shape. It is simply called a relationship.
For Example: Suppose we have two entity type DOCTOR and PATIENT. Entity DOCTOR has attributes Doctor_id, Name, Salary and Qualification. Similarly, entity PATIENT has attributes as Patient_id, Age, Contact_no, Address and P_name. Both are strong entity type as both of them have their own key attribute. Doctor_id is the key attribute for entity DOCTOR and Patient_id is the key attribute for entity type PATIENT. Both these entities have a relationship which is a one-to-many relationship. Each doctor many treat more than one patient. Here, the relationship and the entity type are connected by a single line. Also, it may be possible that all the doctors are related to some patients. It may be possible that some doctors are not related to any patients. So, there may or may not be total participation of a strong entity in a relationship.
Weak entity type doesn’t have a key attribute. Weak entity type can’t be identified on its own. It depends upon some other strong entity for its distinct identity. It is represented by a double outlined rectangle. This can be understood with real-life examples. There can be children only if the parent exits. There can be no independent existence of children. There can be a room only if building exits. There can be no independent existence of a room.
A weak entity is represented by a double outlined rectangle. The relationship between a weak entity type and strong entity type is called an ‘identifying relationship’ and shown with a double outlined diamond instead of a single outlined diamond. The strong entity is some times called the dominant entity and the dependant entity is called a subordinate entity. As weak entity does not has any key attribute but we need some attribute which along with the primary key of the dominant entity allows the subordinate entity to be identified uniquely. This attribute is called the discriminator of the weak entity. It is also called as the partial key.
The weak entity shows total participation in its relations and this is represented by a double line. Total participation means each entity in the weak entity type is related to one of the entities in the strong entity type. Now, we will try to understand the above-mentioned terms with the help of an example.
Example: Suppose we have two entity type EMPLOYEES and DEPENDANT (children of the employee). The EMPLOYEE entity has attributes as Emp_id, Emp_name, Job_title, Age, Salary, Address. And, the DEPENDANT has attributes as Name, Age and Relation. So, Emp_id is the key attribute of the EMPLOYEES entity type. So, EMPLOYEES is a strong entity and DEPENDANT is a weak entity. The discriminator or the partial key for the weak entity here is the ‘name’ attribute. This partial key along with the key attribute of the EMPLOYEE helps in identifying each DEPENDANT entity uniquely. Also, each and every DEPENDANT entity is related to one of the EMPLOYEE entity. All the EMPLOYEE entity may not be related to one or the other DEPENDANT entity but all the DEPENDANT entity is related to one or the other EMPLOYEE entity. This is called total participation. The strong entity EMPLOYEE is used to identify the weak entity DEPENDANT. So, there is a relationship between these two entity type. This relationship is called an identifying relationship. The above relationship can be represented by the E-R diagram in the following way.
Difference between Strong entity and Weak Entity
- Key Attribute: Strong Entity has a Key attribute whereas the weak entity doesn't have a key attribute. Instead, a weak entity has partial key or discriminators. These discriminators along with the key attribute of the strong entity act as a primary key for the weak entity. Also, the key attribute of the strong entity is represented by underline whereas the discriminator of the weak entity is represented by the dashed line.
- Existence: A weak entity depends on a strong entity for its existence whereas a strong entity has its own independent existence. It means that we can uniquely identify the data from the strong entity using its own attributes only. But, for identifying any data from a weak entity uniquely we need the key attributes of the strong entity.
- Notation: A strong entity is represented by a single outlined rectangle whereas a weak entity is represented by a double outlined rectangle.
- Relationship: Relationship between two strong entity type is represented by a diamond shape. It is simply called a relationship. But, the relationship between a strong and weak entity is represented by a double diamond shape. It is called Identifying Relationship.
- Participation: Total Participation may or may not exits in relationship between strong entity but the weak entity always show total participation in identifying relationship. Also, the line connecting the strong entity with the relationship is single. But, the line connecting a weak entity with the identifying relationship is double.
This is all about the weak and strong entity. Hope you learned the difference between these two.
Keep Learning :)