Many to Many Cardinality

Let us consider the above example with the change that now a student can enroll in more than 1 course.

Many to Many

Table Student

SID Name
1 A
2 B
3 C
4 D

Table Course

CID C_Name
C1 Z
C2 Y
C3 X

Table Enroll

SID CID
1 C1
1 C2
2 C1
2 C2
3 C3
4 C2

Now, the same question arises. What is the primary key to Enroll relation? If we carefully analyze, the primary key for Enroll table is ( SID, CID ). 

But in this case, we can’t merge Enroll table with any of the Student and Course. If we try to merge Enroll with any one of the Student and Course it will create redundant data. 

Note: A minimum of three tables are required in the Many to Many relationships.

Minimization of ER Diagrams

Pre-Requisite: ER Diagram

Entity-Relationship (ER) Diagram is a diagrammatic representation of data in databases, it shows how data is related to one another. In this article, we require previous knowledge of ER diagrams and how to draw ER diagrams.

Minimization of ER Diagram simply means reducing the quantity of the tables in the ER Diagram. When there are so many tables present in the ER DIagram, it decreases the readability and understandability of the ER Diagram, and it also becomes difficult for the admin also to understand these. Minimizing the ER Diagram helps in better understanding. We reduce tables depending on the cardinality.

Similar Reads

Cardinality

Cardinality means that what is the number of relationships between the two entity sets in any relationship model. There are four types of cardinality which are mentioned below....

Many-to-One Cardinality

For example, a student can be enrolled only in one course, but a course can be enrolled by many students....

Many to Many Cardinality

Let us consider the above example with the change that now a student can enroll in more than 1 course....

One-to-One Cardinality

One to One Cardinality has two possible cases where we have the case of either total participation or no participation at one end....

FAQs

1. What is an ER Diagram?...

Contact Us