PRAGMA foreign_keys = ON; CREATE TABLE t(k PRIMARY KEY, x); CREATE TABLE u(k, x, FOREIGN KEY(k) REFERENCES t(k) ON DELETE CASCADE); INSERT INTO t(k, x) VALUES (10, 100); INSERT INTO u(k, x) VALUES (10, 200); DELETE FROM t WHERE k = 10; SELECT count(*) from u;
count(*) |
---|
0 |