can the foreign key refer to Alternate Key
692864Apr 24 2009 — edited Apr 24 2009Hi I have 3 tables
Code( code_name,code_id) primary key Code_name ( i put this as primary key coz queries will be based on the name and not the id)
There are 2 other tables
Static_codes(code_id,......) ..... represents additonal attribtues
dynamic_codes(code_id, ......)
now in this scenario..... the code_id's in these two tables.. should refer to code_id from CODE table
but for that code_id should be a primary key which is not the case here
so how to enforce the referential integrity for static and dynamic tables ?
I do not want code_name to be present in the static_codes and dynamic_codes......
so can i make code_id as alternate key in the CODE table and enforce it ....?