Hello all,
I have a class of tables which I need to relate to a single table. Ideally, I would like to make use of DB foreign key constrains (as the rest of the app has done), however there are some issues with respect to the relationship that makes this a bit difficult. I'll discuss the details below.
Let's say I have a class of similar tables (A1, A2, A3). Logically, these are the parent tables which have related children in table B. I'm struggling with how to implement a foreign key on table B that is constrained to the primary key of table A1 OR table A2 OR table A3.
The only options I see are to forgo FK constraints at the DB layer, or duplicate an identical table B for each of the A tables (A1->B1, A2->B2, A3->B3).
Any insight or advice would be greatly appreciated.