-- DELETE driven by a correlated set from a subquery, the shape oi uses to prune -- a layer's dependent rows: child rows whose parent is flagged 'drop' go away. CREATE TABLE parent (id INTEGER PRIMARY KEY, name TEXT); CREATE TABLE child (pid INTEGER, tag TEXT); INSERT INTO parent (id, name) VALUES (1, 'keep'), (2, 'drop'), (3, 'drop'); INSERT INTO child (pid, tag) VALUES (1, 'x'), (2, 'y'), (3, 'z'), (1, 'w'); DELETE FROM child WHERE pid IN (SELECT id FROM parent WHERE name = 'drop');