Can i include foreign key in composite primary key. I will explain the situation with classical DEPT and EMP table.
In EMP table, can i have composite primary key that includes DEPT number. If it is acceptable, how to add composite primary key in oracle sql data modeler ??
1 - 10
2 - 10
3 - 10
1 - 20
2 - 20
3 - 20
Foreign Key establishes relationship between a primary key or a unique key in the same table or different table.In your example emp table have only composite primary key.that means composite value must unique.so that dept number may or may not unique value.if you try to set foreign key,it will throw error. ORA-02270: no matching unique or primary key for this column-list
Edited by: Neelan on Jan 1, 2013 10:05 PM