Christopher Adkins Christopher Adkins - 3 months ago 20
MySQL Question

MYSQL Error 1064: Create Event

Still new to MySQL. Where did I go wrong in my syntax?

CREATE EVENT `event_name` ON SCHEDULE EVERY 15 MINUTE ON COMPLETION PRESERVE
DO
BEGIN
INSERT INTO table_1 (column_name) SELECT column FROM table_1 WHERE column REGEXP 'regex_string'
END;

Answer

Remove that BEGIN and END since it's not a compound statement and also if your column name is column then escape it like

CREATE EVENT `event_name` ON SCHEDULE EVERY 15 MINUTE ON COMPLETION PRESERVE
DO
INSERT INTO table_1 (column_name) 
   SELECT `column` FROM table_1 
   WHERE `column` REGEXP 'regex_string';

Refer MySQL Documentation