Many-to-Many Relationship

noun

say it: “MEN-ee too MEN-ee rih-LAY-shun-ship” /ˈmɛni tuː ˈmɛni rɪˈleɪʃənʃɪp/

A link where rows on both sides can each be linked to many rows on the other, using a junction table.

What is Many-to-Many Relationship in a relational database?

Many-to-Many Relationship — A relationship where rows on both sides can relate to many rows on the other side.

CREATE TABLE enrollment (
    student_id INTEGER REFERENCES student (student_id),
    course_id INTEGER REFERENCES course (course_id),
    PRIMARY KEY (student_id, course_id)
);

In a sentence

  • “Orders and Products have a many-to-many relationship through Order Details.”

Level: Novice · More Database terms at this level

Updated