Foreign Key with NO primary key to refer

前端 未结 1 906
遥遥无期
遥遥无期 2021-01-19 03:59

I have following two tables.

CREATE TABLE parent
( c1 INTEGER );

CREATE TABLE child
(
 c1 INTEGER,
 c2 INTEGER,
 c3 INTEGER,
 CONSTRAINT fk_c3 FOREIGN KEY(c         


        
相关标签:
1条回答
  • 2021-01-19 04:39

    Is there any way to refer it in Child table without making 'c1' as a primary key?

    Yes. A foreign key needs only to refer to a unique constraint - it does not have to be a primary key. You could create a unique contraint on that column.

    0 讨论(0)
提交回复
热议问题