MySQL / phpMyAdmin is dependent on DELIMITER

Running this procedure causes MySQL (or phpMyAdmin) to freeze. I have to stop MySQL with the XAMPP command, which freezes and doesn't respond about 20 seconds before it stops. I believe this is caused by the separator command, which in itself starts the problems. I tried using a different delimiter ("//") without effect.

DELIMITER $ CREATE TRIGGER coroner AFTER INSERT ON events FOR EACH ROW BEGIN UPDATE teams WHERE id = NEW.victim SET live = live-1; UPDATE teams WHERE id = NEW.shooter SET score = score+points; END $ DELIMITER ; 
+4
source share
2 answers

As it turns out, phpMyAdmin has a field marked as "delimiter:" under the SQL query field. Using this solution, not a team, solves the problem. Further research will explain that DELIMITER is not a SQL command, but a command that is typically implemented by all SQL ui.

+5
source

The update team should:

 update teams set live = live-1 where id = new.victim; update teams where id = new.shooter set score = score+points; 

the where after the set clause

0
source

All Articles