Toad World® Forums

Many to Many relationship

Hello,

Have a clarification on many to many relationship in physical data model. In a table can we create many to many relationship for a FK column ?

Here is an example: Table A has two foreign key columns with other non key columns. Data in this 2 FK columns will have multiple records associated to parent table B and C.

I tried to create many to many relationship between parent table PK column and child tables FK column by selecting M:N relationship in TDM. After pointing to both parent and child table, by default a bridge table is created.

However, from the bridge table relationship I am unable to point the child tables FK column. Please advise.

Thanks !!
Rajesh

Hello Rajesh,
I'm not sure that I understand right. In fact in a relation DB is not possible to create M:N relationship. So it will be always divided to two N:1 relationships and a bridge table.
image

When you open a relationship properties dialog, you can manage key for the relationship. So you can determine which columns will be migrated to a Bridge table.
In my example the relationship1 is create with default settings, so PK1 and PK2 attributes are migrated to the Bridge table. In the table A is not primary key. I just create an alternative key and put to this key attributes FK1 and FK2. In relationship2 properties dialog I set this alternative key, so FK1 and FK2 attributes are created in bridge table.
image

Regard
Petr

Thanks for the clarification Daril.