Strong and weak entity types in database are the two types of entities. But first, we should know what entities mean? An entity is what you called a unique object in the real world. Entities are described as the set of attributes. When you collect the same types of entities together they form an entity set.
We are here to discuss Strong and weak entity types in database. How the weak entity depends on the strong entity for its existence. The difference between the Strong entity and weak entity with the help of comparison chart shown below.
Also Read: Create a module in python: Different methods
You can check out the Comparison chart below:
|Basis of Comparison||Strong Entity||Weak Entity|
|Depends||The Strong entity is also independent of any other entity in a schema.||A weak entity depends also on the strong entity for its existence.|
|Basic||The Strong entity also has a primary key.||The weak entity also has a partial discriminator key.|
|Denoted||The strong entity is also denoted by a single rectangle.||The weak entity is also denoted with the double rectangle.|
|Participation||A strong entity may or may not have total participation in the relationship.||Weak entity always has total participation in the identifying relationship shown by double line.|
|Relation||The relation between two strong entities is also denoted by a single diamond simply called relationship.||The relationship between a weak and a strong entity is also denoted by Identifying Relationship denoted with double diamond.|
Definition of Strong Entity:
We can say that a Strong Entity is one whose existence. But does not depend on the other entity in a schema. Strong Entity is denoted by a single rectangle. But a strong entity always contains a primary key in the set of attributes that also describes the strong entity. Which states that each entity is a strong entity that can also be uniquely identified.
A group of similar types of strong entities can together form a Strong Entity Set. A strong entity also holds a relationship with the weak entity through the method called Identifying relationship. The relationship is also denoted by a double diamond in the ER diagram. Whereas on the other hand a group of two strong entities is shown by a single diamond and it is called a relationship.
Now let us understand the concept with an example a customer takes a loan. Now here we have two entities first a customer entity and also second a loan entity.
So, if you observe an ER diagram given above for each loan. It is necessary to have at least one borrower otherwise that loan would be listed as single entity. But if the customer does not lease any loan it would be listed as a Customer entity set. So from this, we can derive that the customer entity does not depend on a loan entity.
The other thing that you can observe that the customer entity has an primary key Cust_ID which will uniquely identify each entity as an Customer Entity set. This makes customer entity a strong entity on which a loan entity depends.
Now Defination of the Weak Entity:
A Weak Entity is something that depends on its owner entity for existence that is the strong entity. A double rectangle represents the Weak entity. A Weak entity does not have a primary key instead it has a partial key which gives a unique description to the Weak entity. You can say that a primary key of a weak entity is a composite key formed by the primary key of the strong entity and also by the partial key of the weak entity.
The class of similar weak entities is called Weak Entity set. A Weak entity and a Strong entity relationship can be denoted by identifying Relationship and that is called double diamond.
A Simple Example to explain things:
Now again let us give you an example this time from the point of view of weak entities. Now this time we have a loan as our Weak Entity and as we told you earlier for each loan there must be a borrower. As you can see in the loan entity set no customer has a borrower of a car loan. So, it gets totally vanished form the loan entity set. Now for the presence in the car loan entity set, it must be borrowed by the customer. In this way, the weak Loan entity is dependent on the strong Customer entity.
The second thing that we should know about is that a weak entity does not have a primary key. So here we make the Loan_name, the partial key of the weak entity, and Cust_ID primary key of the customer entity make the primary key of the loan entity.
We can say that a Loan Entity set, we have two exactly same entities that are a Home loan on date 20/11/2015 with amount 20000. Now after that if we have to know who has borrowed the money with the help of the primary key of the weak entity (Loan_name + Cust_ID). So, it will be determined that one home loan is borrowed by Customer 101 Jhon and the other by Customer 103 Ruby. This is how the composed primary key of a weak entity identifies each entity in the weak entity set.
Strong and weak entity types in database clearly explained here. You can also see an example for both the strong and the weak entity that will help you understand things better. Hope you find this information useful. Thank You for the read.