I try to set a foreign key, table2_col2_fk, references to table1_col12_pk. However, the primary key is a combination of columns, and the foreign key only need to link to col2 in Table1. How do I set this up? Do I need to add another column in Table2? If so, how is the foreign key beeing set up? Thanks for the help.
1. Add another column "col1 number" into Table2 and "CONSTRAINT table2_col1_col2_fk FOREIGN KEY (col1, col2) REFERENCES table1"
2. Change the primary key of table1 to "col2" only.
Anyway, the combination of foreign key must be exactly same as the primary key.
Although I'm assuming you know this, I must comment nonetheless. DRI cannot do what you are asking because *you should not be doing* what you you are asking. Step back and re-look at your logical design and take another pass at normalization, because it appears you missed something.
If you want, feel free to provide more information about your particular circumstance and maybe we can help you create a better design.
Bookmarks