diff --git a/2208/存储过程练习题.md b/2208/存储过程练习题.md index 6ca6ad5..aa45c1e 100644 --- a/2208/存储过程练习题.md +++ b/2208/存储过程练习题.md @@ -339,6 +339,16 @@ CALL get_department_employee_count(1); 创建一个存储过程 `get_job_employee_count`,接受职位ID作为参数,返回该职位的员工总数。 ```sql +DELIMITER $$ +DROP PROCEDURE IF EXISTS get_job_employee_count; +CREATE PROCEDURE get_job_employee_count(IN id INT) +BEGIN + SELECT COUNT(*) + FROM employee e + WHERE e.job_id = id; +END $$ +DELIMITER ; +CALL get_job_employee_count(1); ```