Answer the question
In order to leave comments, you need to log in
Why doesn't the ForeignKey constraint work in SQLite?
I can not understand why the restriction on ForeignKey in SQLite does not work. My schema:
CREATE TABLE "address"(
"id" Integer NOT NULL PRIMARY KEY,
"email" Text,
CONSTRAINT "unique_id" UNIQUE ( "id" ) );
CREATE TABLE "mans"(
"id" Integer NOT NULL PRIMARY KEY,
"mail_id" Integer,
"name" Text,
"age" Integer,
CONSTRAINT "mans_address_NO ACTION_NO ACTION_mail_id_id_0" FOREIGN KEY ( "mail_id" ) REFERENCES "address"( "id" )
);
INSERT INTO "address" ( "email", "id") VALUES ( '[email protected]', 4 );
INSERT INTO "mans" ("id", "mail_id", "name") VALUES ( 1 , 2 , 'mike' );
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