Answer the question
In order to leave comments, you need to log in
SQLite Why FOREIGN KEY vseravno allows to interpose a nonexistent field of other table?
CREATE TABLE category (
name TEXT NOT NULL
);
INSERT INTO category(name) VALUES
('food')
;
CREATE TABLE item (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
category TEXT NOT NULL,
FOREIGN KEY (category) REFERENCES category(name)
);
INSERT INTO item(name, category) VALUES
('cookie', 'ololo') -- ok. no error
;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question