Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

can the foreign key refer to Alternate Key

692864Apr 24 2009 — edited Apr 24 2009
Hi 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 ....?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 22 2009
Added on Apr 24 2009
8 comments
787 views