问题: 创建一个仅在官方语言大于75%且非英语的情况下才删除城市的触发器。
数据库链接:http://downloads.mysql.com/docs/world.sql.zip
这是我到目前为止所做的触发器
DELIMITER $$
CREATE TRIGGER deleteonlanguage
AFTER DELETE ON city
FOR EACH ROW
BEGIN
IF (old.countrycode IN (SELECT countrycode FROM countrylanguage WHERE Percentage < 75 AND LANGUAGE LIKE "english"))
THEN signal SQLSTATE '45000'
SET message_text = "You cannot delete this city as the total language percentage is less than 75 or is English";
END IF;
END $$
DELIMITER ;;
希望我可以在此方面获得一些帮助,因为我仍然是SQL noob,谢谢!