This question has already been answered:
- Database Design: Network Connections 2 Responses
There are 2 pairs of tables.
Some reference:
- A (id)
- A_Component (id, a_id)
And any sample from this directory:
- B (id, a_id)
- B_component (id, b_id, ac_id)
Obviously, this structure is locked into a rhombus, where the database does not ensure data integrity - nothing forces the B.a_id and A_Component.a_id match, but we would like.
Once again: it is necessary that B_C.b_id and B_C.ac_id point to the same entity A
I see a couple of possible solutions:
- exclude table
B, thereby breaking the rhombus dependencies.
the solution does not fit, because inBthere is more data related to the entire sample - a set of triggers / constraints that will validate the correctness of the data in the created
B_Component.
this method generates a couple of requests to the base for validation.
Is there a more canonical / elegant way for a similar structure?
