Auto commit
This commit is contained in:
parent
d494b911e0
commit
a546c2f47c
@ -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 $$ #改变代码结束符
|
||||
|
Loading…
x
Reference in New Issue
Block a user