Auto commit
This commit is contained in:
parent
a192d96e71
commit
43b718db0c
@ -319,10 +319,30 @@ CALL get_employee_years_of_service(1);
|
||||
|
||||
创建一个存储过程 `get_department_employee_count`,接受部门ID作为参数,返回该部门的员工总数。
|
||||
|
||||
```sql
|
||||
DELIMITER $$
|
||||
DROP PROCEDURE IF EXISTS get_department_employee_count;
|
||||
CREATE PROCEDURE get_department_employee_count(IN id INT)
|
||||
BEGIN
|
||||
SELECT COUNT(*)
|
||||
FROM employee e
|
||||
WHERE e.dept_id = id;
|
||||
END $$
|
||||
DELIMITER ;
|
||||
CALL get_department_employee_count(1);
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### 练习题 11: 查询职位员工总数
|
||||
|
||||
创建一个存储过程 `get_job_employee_count`,接受职位ID作为参数,返回该职位的员工总数。
|
||||
|
||||
```sql
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### 练习题 12: 查询员工详细信息
|
||||
|
||||
创建一个存储过程 `get_employee_details`,接受员工ID作为参数,返回该员工的姓名、工资、部门名称和职位名称。
|
||||
|
Loading…
x
Reference in New Issue
Block a user