- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Managing Many-to-Many relationship
102 Lectures 7.5 hours
152 Lectures 16 hours
Many to Many relationship implies multiple relationship between any two entities. An example of this is: A class has multiple students but a student also attends multiple classes. So this is a many to many relationship between the entities STUDENT and CLASS.
It is complicated to manage a many to many relationship. We cannot mention all the classes a student attends or all the students in a class in one table. This would become extremely complicated and difficult to understand.
So, we have used a joining table. This is demonstrated as follows −
The Student table stores the details of individual students such as their Student ID, name, age etc.
The Class table stores the details of all the different classes such as the ClassID, Name etc.
The <StudentClass> table is the link between the <Student> and <Class> tables. It stores details about which student attends which classes.
Using this table we can showcase the many to many relationship between <Student> and <Class>. We can easily update the Student and Class tables without interfering with the relationship between them and also update the <StudentClass> as required.
- Many-to-Many Relationship Model
- Many-to-Many Relationship in DBMS
- One-to-Many Relationship Model
- One-to-Many or Many-to-One Relationship in DBMS
- One-to-Many Unary Relationship in DBMS
- Upsert many documents in MongoDB
- MySQL query to select too many rows?
- MongoDB many insertsupdates without affecting performance?
- How many diseases are spread by mosquitoes?
- How many keywords are there in C++?
- A Problem in Many Binary Search Implementations?
- How many Rounds are there in DES?
- Why do many people like to dance a lot?
- How many ways to prevent method overriding in Java?
- How many ways to synchronize an ArrayList in Java?