From 077f0330f52712dad5fab71fa1293b38beda1ea8 Mon Sep 17 00:00:00 2001 From: smallkun Date: Thu, 20 Mar 2025 16:46:44 +0800 Subject: [PATCH] Auto commit --- 2208/存储过程练习题.md | 10 ++++++++++ 1 file changed, 10 insertions(+) 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); ```