Auto commit

This commit is contained in:
smallkun 2025-03-28 10:38:36 +08:00
parent 3fd783abc5
commit 1101eebe94

View File

@ -580,5 +580,25 @@ CREATE VIEW v_education AS
SELECT s.`name` '学生姓名', c.`name` '课程名称', l.`schedule` '学习进度', l.createtime '创建时间' SELECT s.`name` '学生姓名', c.`name` '课程名称', l.`schedule` '学习进度', l.createtime '创建时间'
FROM t_student s, t_learn l, t_course c FROM t_student s, t_learn l, t_course c
WHERE s.id = l.s_id AND l.c_id = c.id; WHERE s.id = l.s_id AND l.c_id = c.id;
#8
CREATE TRIGGER tri_insert_student_learn
AFTER INSERT ON t_student
FOR EACH ROW
BEGIN
INSERT INTO t_learn (s_id, c_id, schedule, createtime)
VALUES (NEW.id, 10001, 0, '2025-01-01');
END
#9
CREATE PROCEDURE `sp_get_student_courses`(
IN in_student_id INT,
OUT out_course_count INT
)
BEGIN
SELECT COUNT(DISTINCT c_id) INTO out_course_count
FROM t_learn
WHERE s_id = in_student_id ;
END
``` ```