From a19a2490e0e57c8c303e83a5f0b774ccf4bd0148 Mon Sep 17 00:00:00 2001 From: smallkun Date: Thu, 20 Mar 2025 16:36:24 +0800 Subject: [PATCH] Auto commit --- 2208/存储过程练习题.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/2208/存储过程练习题.md b/2208/存储过程练习题.md index 07e1f53..aa651a7 100644 --- a/2208/存储过程练习题.md +++ b/2208/存储过程练习题.md @@ -167,6 +167,21 @@ CALL add_employee('李泽龙', 6666, '2025-3-20', 1, 1); 创建一个存储过程 `update_employee_salary`,接受员工ID和新的工资作为参数,更新该员工的工资。 +```sql +DELIMITER $$ +DROP PROCEDURE IF EXISTS update_employee_salary; +CREATE PROCEDURE update_employee_salary(IN emp_id INT, IN salary DECIMAL(10, 2)) +BEGIN + UPDATE employee e + SET e.salary = salary + WHERE e.emp_id = emp_id; +END $$ +DELIMITER ; +CALL update_employee_salary(1, 60000); +``` + + + #### 练习题 3: 删除员工 创建一个存储过程 `delete_employee`,接受员工ID作为参数,删除该员工的记录。