FK on a single column referencing a column from composite PK

后端 未结 2 1873
你的背包
你的背包 2020-12-22 09:15

Not able to create /find the logic to apply FK on a column in child table referencing a column from composite PK of parent table.

create table product(prod_i         


        
2条回答
  •  情歌与酒
    2020-12-22 09:53

    I suspect that this is not unique to Oracle. Considering you have a composite primary key in the referenced table, that implies that only one of the columns comprising the composite key is not enough to uniquely identify the record in that table. Therefore, it's impossible to reference only a single column of the primary key in a foreign key relationship that's one-to-many (e.g. one record in the referenced table can have many records in the referencing table--the one with the FK). However, if the relationship to be established is many-to-many, this may be possible.

    HTH.

提交回复
热议问题