我尝试创建一个触发器,根据输入到另一个表中的内容更新表。基本上,它应该看看用户输入了什么样的菜肴,然后在另一张桌子上更新记录。这是代码:
DELIMITER $$
CREATE TRIGGER UpdateStats AFTER INSERT ON Restaurant
FOR EACH ROW
BEGIN
UPDATE RestaurantStats SET TotalRestaurants = TotalRestaurants + 1 WHERE Cusine = NEW.cusine;
END$$
由于某些原因,我不断收到此错误:
#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