In our DB we have two tables A, B with primary keys A_id and B_id.
Is it a considered a good practice to have B_id as foreign key in table A and A_id as foreign key in table B. This would allow us to have many-to-many relationship in the table.
An alternative would be to have a third bridge table consisting of just two columns A_id and B_id.
Which one do you think is a good practice?
Consider following scenario
If you want to crosslink this, the least you need to do without creating a third table is duplicating every row in one of the two tables. I doubt you’ll find many DBA’s willing to model their tables like that.
A third bridge table really is your only good option here.