From this SO question. I got confused with DELIMITER. And I also tried something like following:
CREATE EVENT test
ON SCHEDULE EVERY 2 MINUTE
DO
BEGIN
SELECT 1;
SELECT 2;
END
This got me error like mentioned question:
Error Code: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 5.
And if I ran the sql following:
DELIMITER $$
CREATE EVENT test
ON SCHEDULE EVERY 2 MINUTE
DO
BEGIN
SELECT 1;
SELECT 2;
END $$
DELIMITER;
This worked and created a new EVENT sucessfully.
The only difference between these two sql is the last one used DELIMITER, so my question is why DELIMITER works here. Can anyone explain to me?
Any help is appreciated and thanks in advance.