Rudolf Adamkovič Personal site


Example: Propagating deletions

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

© 2025 Rudolf Adamkovič under GNU General Public License version 3.
Made with Emacs and secret alien technologies of yesteryear.