clear markdown compare help best fiddles feedback dbanow.uk a leap of faith?
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 1451407 fiddles created (18708 in the last week).

CREATE TABLE t1 (id int, val int);
 hidden batch(es)


CREATE TABLE t2 (id int, val int, t1id int);
 hidden batch(es)


CREATE TABLE t3 (id int, val int, t2id int);
 hidden batch(es)


insert into t1 values (1,1), (2,2), (3,3);
 hidden batch(es)


insert into t2 values (1,1,1),(2,2,1),(3,3,2),(4,4,2),(5,5,4);
 hidden batch(es)


insert into t3 values (1,1,1),(2,2,1),(3,3,2),(4,4,2),(5,5,3), (6,6,3),(7,7,4),(8,8,4),(9,9,5),(10,10,6);
 hidden batch(es)


select * from t1 join t2 on t1.id=t2.t1id join t3 on t2.id=t3.t2id;
id val id val t1id id val t2id
1 1 1 1 1 1 1 1
1 1 1 1 1 2 2 1
1 1 2 2 1 3 3 2
1 1 2 2 1 4 4 2
2 2 3 3 2 5 5 3
2 2 3 3 2 6 6 3
2 2 4 4 2 7 7 4
2 2 4 4 2 8 8 4
 hidden batch(es)


DELETE t1, t2, t3 FROM t1 INNER JOIN t2 ON t2.t1id = t1.id INNER JOIN t3 ON t3.t2id = t2.id WHERE t1.id = 1;
 hidden batch(es)


select * from t1 join t2 on t1.id=t2.t1id join t3 on t2.id=t3.t2id;
id val id val t1id id val t2id
2 2 3 3 2 5 5 3
2 2 3 3 2 6 6 3
2 2 4 4 2 7 7 4
2 2 4 4 2 8 8 4
 hidden batch(es)