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. 1926612 fiddles created (21853 in the last week).

create table main(id int primary key);
 hidden batch(es)


insert into main (id) values (1), (2);
2 rows affected
 hidden batch(es)


select * from main;
id
1
2
 hidden batch(es)


create table slave (id int primary key, main_id int references main (id) on update cascade);
 hidden batch(es)


insert into slave (id, main_id) values (1,1), (2,1), (3,2), (4,2);
4 rows affected
 hidden batch(es)


select * from slave;
id main_id
1 1
2 1
3 2
4 2
 hidden batch(es)


update main set id=12 where id=2;
1 rows affected
 hidden batch(es)


select * from main;
id
1
12
 hidden batch(es)


select * from slave;
id main_id
1 1
2 1
3 12
4 12
 hidden batch(es)