Reputation: 402
I installed eXtremeDB emebeded on my Ubuntu 20.04, and tried following commands:
CREATE TABLE coops (id1 INT NOT NULL, name string NOT NULL, PRIMARY KEY (id1));
CREATE TABLE factories (id INT NOT NULL, name string NOT NULL, coop INT NOT NULL, PRIMARY KEY (id), FOREIGN KEY (coop) REFERENCES coops (id1));
I found it available to insert rows intn factories
while coops
contains nothing. Like below:
// no rows in coops
INSERT INTO factories values (1, 'a', 1);
And Metatable
reveals that no column had referenced.
Why does my foreign key failed?
Upvotes: 1
Views: 35