[WEBINAR] Bulletproof: How Today's Business Leaders Stay on Top

Many-to-Many Relationship

Definition - What does Many-to-Many Relationship mean?

A many-to-many relationship refers to a relationship between tables in a database when a parent row in one table contains several child rows in the second table, and vice versa. Many-to-many relationships are often tricky to represent.

The many-to-many relationship is usually a mirror of the real-life relationship between the objects the two tables represent.

Techopedia explains Many-to-Many Relationship

A database used by a school application can be taken as an example. Two of the tables it contains are "Student" and "Subject." In real life, a student will take several subjects simultaneously, while a subject will be studied by several students at a time. This is a many-to-many relationship.

In a database, such a relationship has to be broken down into intermediary tables. In our school example, this may take the form of a third table that contains the columns “Student_ID”, “Subject_ID”, “Semester” and “Year”. For each student who takes a certain subject in a certain semester in a certain year, a row can be entered into this table. The Student_ID is read from the Student master table, while the Subject_ID is read from the Subject master table. In this way, many students can be related to many subjects.

Another example can be a relationship between employees and departments. Each department can have any number of employees working on a specific task. Similarly, an employee can also work for multiple departments at one time. Therefore, any number of departments or employees can simultaneously be linked to each other by creating an intermediary table that links them using the Employee_ID and the Department_ID.

Share this:

Connect with us

Email Newsletter

Join thousands of others with our weekly newsletter

The 4th Era of IT Infrastructure: Superconverged Systems
The 4th Era of IT Infrastructure: Superconverged Systems:
Learn the benefits and limitations of the 3 generations of IT infrastructure – siloed, converged and hyperconverged – and discover how the 4th...
Approaches and Benefits of Network Virtualization
Approaches and Benefits of Network Virtualization:
Businesses today aspire to achieve a software-defined datacenter (SDDC) to enhance business agility and reduce operational complexity. However, the...
Free E-Book: Public Cloud Guide
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomic
Free 30 Day Trial – Turbonomic:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.