add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
create table mytable(
watch int,
not_watch int,
safeguard int );
CREATE TRIGGER updtrigger BEFORE UPDATE ON mytable
FOR EACH ROW
BEGIN
IF NEW.watch <> OLD.watch THEN
SET NEW.safeguard = new.watch;
END IF;
END
insert into mytable values (25,20,0);
update mytable set watch = 50;
Rows matched: 1  Changed: 1  Warnings: 0
select * from mytable;
watch not_watch safeguard
50 20 50
update mytable set watch = 75;
Rows matched: 1  Changed: 1  Warnings: 0
select * from mytable;
watch not_watch safeguard
75 20 75
update mytable set not_watch = 100;
Rows matched: 1  Changed: 1  Warnings: 0
select * from mytable;
watch not_watch safeguard
75 100 75