Auto commit

This commit is contained in:
smallkun 2025-02-28 10:49:20 +08:00
parent 1a337cdb21
commit 7fb72c827d

View File

@ -258,7 +258,7 @@ HAVING COUNT(*) = ( #子查询用来统计这个类别中 数量最多的作者
LIMIT 1
);
#10
#10 触发器
DELIMITER $$
DROP TRIGGER IF EXISTS tri_updateCentury;
CREATE TRIGGER tri_updateCentury
@ -287,5 +287,18 @@ DELIMITER ;
SELECT CONCAT(FLOOR(YEAR(publication_date)/100) + 1, '世纪')
FROM tb_books;
#11 存储过程
DELIMITER $$
DROP PROCEDURE IF EXISTS pro_GetTopFictionPrice;
CREATE PROCEDURE pro_GetTopFictionPrice(IN in_genre VARCHAR(255), OUT out_title VARCHAR(255))
BEGIN
SELECT b.title INTO out_title
FROM tb_books b
WHERE b.genre = in_genre AND YEAR(b.publication_date) BETWEEN 2000 AND 2099
ORDER BY b.price DESC
LIMIT 1;
END $$
DELIMITER ;
```