Relationship Types
![Relationship Types Relationship Types](https://www.h2kinfosys.com/blog/wp-content/uploads/2024/06/Copy-of-ba-online-training-11.png)
One -to -many relationship or many to one relationship
This relationship is used to generate relationship between two labels where single row of the first table will be only related to one and only one record of second table and the row of the second table will be related to anyone of the first table and this relationship is most common relationship which has been found.
This will be into existence mainly in the database when one of the row in the first table will be linked to many rows in second table of the rows but we need to see that the only one row in the second table will be linked to one row in the first table.
We can see other example as customer who can have many sales order. Here the primary key in the Customer table is the CustomerID will be maintained to contain the unique values so that it will be easy to categorise.
One- to -many relationships will also be said as many to one relationship which depends up on the way we will see it.
Example: Suppose if there are two entities which is customer who will have account. Then every customer can have more than one account.
and as each account will be held by the only one customer.
Example for the relationship:
In this we need to say that the each customer is been associated with many accounts which is one -to -many relationship.
But suppose if we see it the other way many accounts are associated with one customer then we say many to one relationship.
Many-to-Many relationship
This relationship will be survived when each record of the first table will be connected to one or more than one record of the second table and the single record of the second table will be related to the first table.
Linking tables will link two tables by having fields which will be the primary key of the other two tables
In the above example we can see that there are two entities among them so one is the customer and other is the product. Each customer will buy more than one product and a product can be bought by many different customers.
Participation constraints
This relationship will be between two strong entities or may be strong entity and weak entity depending upon the type of entity participation in the relationship and the participation will be of two types that are:
- Partial participation
- Total participation
- Partial participation: this will be existed when all the entity of the entity type is not been associated with one or the other entity of another entity type which will be expressed by the joining relationship with entity type with one line as we can see in the below example.
Here we can see that we have two entities that is Customer and Order. Then there are customers who will not have order so here there will be partial participation of entity in the relationship.
- Total participation: This will be existed when all the entity type will be associated with one or the other entity of another entity type and this will be represented by the connecting relationship with entity type with the taking help of double parallel line.
This is the example for the two entities, one is employee and other is dependent where all the dependent entity will be related to the one or other employee entity which is known as total participation. This will be possible that employee is not related to any dependent entity, so employee will be showing partial participation where as dependent will be showing in the relationship.
Questions
- What many to many relationship? Explain
- Explain partial and total participation briefly
- What is one to many relationship?
- What is total participation explain with example?