Auto commit

This commit is contained in:
smallkun 2025-02-21 11:47:48 +08:00
parent d494b911e0
commit a546c2f47c

View File

@ -60,6 +60,24 @@ WHERE money >= 5000 AND money <= 8000;
#6
#9 触发器
DELIMITER $$
DROP TRIGGER IF EXISTS tri_updateGroup;
CREATE TRIGGER tri_updateGroup
BEFORE UPDATE ON t_employee
FOR EACH ROW
BEGIN
IF NEW.age != OLD.age THEN
IF NEW.age<30 THEN
SET NEW.groups = '青年';
ELSEIF NEW.age<50 THEN
SET NEW.groups = '中年';
ELSE
SET NEW.groups = '老年';
END IF;
END IF;
END $$
DELIMITER ;
#10 存储过程
DELIMITER $$ #改变代码结束符