Many to Many Relation on Works_On Relationship Type

For Complete YouTube Video: Click Here

In this class, we will understand Many to Many Relation on Works_On Relationship Type.

We have already discussed the concept of the cardinality ratio.

Many to Many Relation on Works_On Relationship Type

Consider the entity type project to the ER-Diagram that has been obtained so far, as shown below.

Many to Many Relation on Works_On Relationship Type
Many to Many Relation on Works_On Relationship Type

From the above diagram, can we identify any new relationship types?

We have already discussed how to identify a relationship type.

The works_on attribute of the employee entity type is related to the projects entity type.

So the works_on attribute is converted into a relationship.

We will move the attributes hours of the work_on to the works_on relationship as they are related to the works_on.

As works_on is itself representing the projects, we will remove the projects attribute.

The image below is the ER-Diagram with the works_on relationship.

Many to Many Relation on Works_On Relationship Type 2
Many to Many Relation on Works_On Relationship Type 2

Cardinality Ratio & Participation Constraint of a works_on Relationship

Cardinality Ratio

The requirements state that “An employee is assigned to one department, but may work on several projects.”

An employee can work on several projects the maximum participation is many.

As the employees can work on several projects, a project will also have several employees.

The maximum participation of the project entity type is also many.

The image below is the ER_diagram with the cardinality ratios.

Many to Many Relation on Works_On Relationship Type 3
Many to Many Relation on Works_On Relationship Type 3

Participation Constraint

The employee entity type has full participation because it is mandatory to assign a project to the employee.

An employee has to work on at least one project.

Similarly, a project should have at least one employee.

So, the project has full participation.

Both employee and project entity types have full participation in the works_on relationship type.

The image below is the ER-Diagram.

Many to Many Relation on Works_On Relationship Type 4
Many to Many Relation on Works_On Relationship Type 4