Search code examples
database-designrdbms

Best way to design a table with m:n relation


What is the best way to design a table for a m:n relation between two entities??


Solution

  • Three tables. One defining the first entity, one defining the second, and a third representing the relationship between them.

    • Table 1 (first entity): T1Id, T1Name
    • Table 2 (second entity): T2Id, T2Name
    • Table 3 (relationship): T1Id, T2Id