Reputation: 57
I have one "sub-table" (C) and two "super-table" (A, B):
To make multiple inheritance, I can easily state that C.id1 refers to A.id and C.id2 to B.id by creating FOREIGN KEYs. However, owing to my model (actually because A and B are also inheritance of an other super-table), id1 and id2 will always have the same value for one occurence. My question is, do you think I need to create an additionnal "id" column in the C table as PRIMARY KEY in addition to "id1" and "id2" forein key ? More easily, can I just arbitrary pick id1 or id2 column and define it as PRIMARY KEY ?
I don't know if I'm very clear. If not, please tell me how you usually modelize multiple inheritance in SQL.
Upvotes: 0
Views: 956
Reputation: 5147
You should not arbitrary pick id1 or id2 column and define it as PRIMARY KEY. Its best to have a different id as primary key in C table. Hope its clear to you if not please update.
Upvotes: 1