Auto commit
This commit is contained in:
parent
d9e06991e9
commit
bf07420a5e
@ -207,6 +207,21 @@ CALL add_employee('李泽龙', 6666, '2025-3-20', 1, 1);
|
||||
|
||||
创建一个存储过程 `get_employee_details`,接受员工ID作为参数,返回该员工的姓名、工资、部门名称和职位名称。
|
||||
|
||||
```sql
|
||||
DELIMITER $$
|
||||
DROP PROCEDURE IF EXISTS get_employee_details;
|
||||
CREATE PROCEDURE get_employee_details(IN emp_id INT)
|
||||
BEGIN
|
||||
SELECT e.emp_name, e.salary, d.dept_name, j.job_title
|
||||
FROM employee e, department d, job j
|
||||
WHERE e.emp_id = emp_id AND e.dept_id = d.dept_id AND e.job_id = j.job_id;
|
||||
END $$
|
||||
DELIMITER ;
|
||||
CALL get_employee_details(1);
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### 练习题 13: 查询部门最高工资
|
||||
|
||||
创建一个存储过程 `get_department_max_salary`,接受部门ID作为参数,返回该部门的最高工资。
|
||||
|
Loading…
x
Reference in New Issue
Block a user