0

So a join table for many-to-many is typically(?) a two-column table with foreign keys to two other tables.

I have a colleague that insists on putting an FK in two tables that are FKs to a "join" table that contains only a column of PKs.

Example: A and B have FKs to join table C. A and B are joined by having a mutual C FK. An m::m can be represented like rows A1=>C1, A2=>C1, A3=>C2; B1=>C1, B2=C2, B3=>C1, B4=>C2

The many-to-many is then A1,A2::B1,B3; A3::B2,B4

I guess the problem is if you later want to join A1 to B2, it's not possible because A1 and B2 are already bound to different FK's in C. But this might be okay if A's and B's are immutable.

Hope that make some sort of sense :-P

4
  • 2
    The many-to-many is then A1,A2::B1,B3; A3::B2,B4 It is NOT many-to-many. It is 3-entity scheme where A and B are 1st and 2nd entities and С is 3rd virtual entity. And in this scheme entity С is referenced by A and by B separately and independently, each as one-to-many. Or you can take this scheme as (group from A)-to-(group from B).
    – Akina
    Commented Mar 1, 2019 at 9:08
  • For example, how will you modify the data, what record(s) will be added, for to add a reference A1::B2?
    – Akina
    Commented Mar 1, 2019 at 9:12
  • @Akina, that's why I mentioned A and B being immutable. Once the relations are defined, they are not modified at a later time. I agree it's not a true association between A and B tables, but an association by common reference. I'm not familiar with the term '3-entity', so I will research that. Commented Mar 1, 2019 at 9:18
  • 1
    Consider С as an entity "a group which can contains a lot of entities A and B" where A/B entity can NOT be referenced to more than one group (C entity).
    – Akina
    Commented Mar 1, 2019 at 9:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.