There are no primary or candidate keys in the referenced table that match the referencing column list in the foreign key

后端 未结 4 535
温柔的废话
温柔的废话 2020-11-30 07:12

In SQL Server , I got this error ->

\"There are no primary or candidate keys in the referenced table \'BookTitle\' that match the referencing colum

4条回答
  •  孤街浪徒
    2020-11-30 07:46

    You need either

    • A unique index on Title in BookTitle
    • An ISBN column in BookCopy and the FK is on both columns

    A foreign key needs to uniquely identify the parent row: you currently have no way to do that because Title is not unique.

提交回复
热议问题