我想创建触发器,已经编写了这个查询语句,但是无法执行。请检查我的查询语句。
CREATE
TRIGGER 'blog_after_insert' AFTER INSERT
ON 'blog'
FOR EACH ROW BEGIN
IF NEW.deleted THEN
SET @changetype = 'DELETE';
ELSE
SET @changetype = 'NEW';
END IF;
INSERT INTO audit (blog_id, changetype) VALUES (NEW.id, @changetype);
我遇到了这个错误。
#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 ''blog_after_insert' AFTER INSERT
ON 'blog'
FOR EACH ROW BEGIN
IF NEW.del' at line 2