Auto commit
This commit is contained in:
parent
bf07420a5e
commit
a19a2490e0
@ -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作为参数,删除该员工的记录。
|
||||
|
Loading…
x
Reference in New Issue
Block a user