Auto commit
This commit is contained in:
parent
297f2784fb
commit
2be46d87e0
@ -148,6 +148,22 @@ INSERT INTO employee (emp_name, salary, hire_date, dept_id, job_id) VALUES
|
||||
|
||||
创建一个存储过程 `add_employee`,接受员工姓名、工资、入职日期、部门ID和职位ID作为参数,并将其插入到 `employee` 表中。
|
||||
|
||||
```sql
|
||||
DELIMITER $$
|
||||
DROP PROCEDURE IF EXISTS add_employee;
|
||||
CREATE PROCEDURE add_employee(IN emp_name VARCHAR(100), IN salary DECIMAL(10,2),
|
||||
IN hire_date DATE, IN dept_id INT, IN job_id INT)
|
||||
BEGIN
|
||||
INSERT INTO employee()
|
||||
VALUES(DEFAULT, emp_name, salary, hire_date, dept_id, job_id);
|
||||
END $$
|
||||
DELIMITER ;
|
||||
|
||||
CALL add_employee('李泽龙', 6666, '2025-3-20', 1, 1);
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### 练习题 2: 更新员工工资
|
||||
|
||||
创建一个存储过程 `update_employee_salary`,接受员工ID和新的工资作为参数,更新该员工的工资。
|
||||
|
Loading…
x
Reference in New Issue
Block a user