From d59764c856d0d236522281df4c93303de876a66c Mon Sep 17 00:00:00 2001 From: smallkun Date: Thu, 27 Feb 2025 10:17:04 +0800 Subject: [PATCH] Auto commit --- 2208/天天乐学考试答案/MySQL练习(一).md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/2208/天天乐学考试答案/MySQL练习(一).md b/2208/天天乐学考试答案/MySQL练习(一).md index 803e4d8..9b6aa6b 100644 --- a/2208/天天乐学考试答案/MySQL练习(一).md +++ b/2208/天天乐学考试答案/MySQL练习(一).md @@ -160,21 +160,18 @@ WHERE h.hid = r.hid AND r.price =( #8 触发器 DELIMITER $$ -DROP TRIGGER IF EXISTS tri_updateInteroduce; -CREATE TRIGGER tri_updateInteroduce +DROP TRIGGER IF EXISTS tri_updateIntroduce; +CREATE TRIGGER tri_updateIntroduce BEFORE UPDATE ON t_hotel FOR EACH ROW BEGIN - IF NEW.`level` <> OLD.`level` THEN - IF NEW.`level` IN ('一星', '二星') THEN + IF NEW.`level` = '一星' OR NEW.`level` = '二星' THEN SET NEW.introduce = '实用'; - ELSEIF NEW.`level` IN ('三星', '四星') THEN + ELSEIF NEW.`level` = '三星' OR NEW.`level` = '四星' THEN SET NEW.introduce = '豪华'; - ELSE + ELSEIF NEW.`level` = '五星' THEN SET NEW.introduce = '奢华'; END IF; - END IF; - END $$ DELIMITER ; @@ -188,8 +185,12 @@ BEGIN WHERE h.hid = r.hid AND r.rname = in_rname ORDER BY r.price LIMIT 1; - END $$ DELIMITER ; + +CALL pro_GetLowPrice('标准间', @result); +SELECT @result; ``` +### 第三套 +