Following are two tables and facing problem in creating the second table.
CREATE TABLE Blocks (
Floors INTEGER NOT NULL,
Code INTEGER NOT NULL,
PRIMARY KEY(Floors, Code)
);
CREATE TABLE Room (
Number INTEGER PRIMARY KEY NOT NULL,
Type TEXT NOT NULL,
BlockFloor INTEGER NOT NULL
CONSTRAINT fk_Block_Floor REFERENCES Blocks(Floors),
BlockCode INTEGER NOT NULL
CONSTRAINT fk_Block_Code REFERENCES Blocks(Code),
Unavailable BIT NOT NULL
);
I am getting the following error while executing the second table.
There are no primary or candidate keys in the referenced table 'Blocks' that match the referencing column list in the foreign key 'fk_Block_Floor'.
What can be the possible reason for the error to occur? Kindly guide.