I have following two tables.
CREATE TABLE parent
( c1 INTEGER );
CREATE TABLE child
(
c1 INTEGER,
c2 INTEGER,
c3 INTEGER,
CONSTRAINT fk_c3 FOREIGN KEY(c3) REFERENCES parent(c1)
);
You must have noticed that column c1
is NOT a primary key in Parent table.
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.