Lets say I have:
CREATE TABLE A (
a int,
b int,
PRIMARY KEY(a, b)
);
This works successfully. Now I have a
and b
as the primary keys (which implies that they are unique).
Then I do:
CREATE TABLE B (a int,
b int,
FOREIGN KEY(a) REFERENCES A(a),
FOREIGN KEY(b) REFERENCES A(b)
);
But this gives me an error there is no unique constraint matching given keys for referenced table "a"