ALTER TRIGGER [dbo].[tri_test2] ON [dbo].[student] for INSERT,DELETE,UPDATEAS BEGIN if not exists (select * from deleted) --新增 insert student2(stu_id,stu_name,stu_sex,stu_birthday,class_id) select stu_id,stu_name,stu_sex,stu_birthday,class_id from in…
一.SQL语言查询选修了全部课程的学生的学号和姓名. 两种解决途径: 第一种: 我们可以表示为在SC表中某个学生选修的课程数等于C表中课程总数.相应的SQL语言如下: select S#,SNAME from S where S# in (select S# from SC group by S# --根据Sno分组,统计每个学生选修了几门课程.如果等于C表课程的总数,就是我们要找的S# having count(*) = (select count(*) from C))--统计C表中共有几门…