From 5d16a365deb59e399d14f920474d6e9414d46da1 Mon Sep 17 00:00:00 2001 From: smallkun Date: Thu, 20 Mar 2025 16:47:18 +0800 Subject: [PATCH] Auto commit --- 2208/存储过程练习题.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/2208/存储过程练习题.md b/2208/存储过程练习题.md index aa45c1e..d4e4c13 100644 --- a/2208/存储过程练习题.md +++ b/2208/存储过程练习题.md @@ -376,6 +376,21 @@ CALL get_employee_details(1); 创建一个存储过程 `get_department_max_salary`,接受部门ID作为参数,返回该部门的最高工资。 +```sql +DELIMITER $$ +DROP PROCEDURE IF EXISTS get_department_max_salary; +CREATE PROCEDURE get_department_max_salary(IN id INT) +BEGIN + SELECT MAX(e.salary) + FROM employee e + WHERE e.dept_id = id; +END $$ +DELIMITER ; +CALL get_department_max_salary(1); +``` + + + #### 练习题 14: 查询职位最低工资 创建一个存储过程 `get_job_min_salary`,接受职位ID作为参数,返回该职位的最低工资。