创建一触发器Student,当向表中插入或者删除记录时,修改表Class中相应的人数
2个回答
展开全部
create trigger trigger_insert on student
for insert
as
update class
set 人数=人数+1
where unitid=(select unitid from inserted)
create trigger trigger_insert on student
for delete
as
update class
set 人数=人数-1
where unitid=(select unitid from deleted)
for insert
as
update class
set 人数=人数+1
where unitid=(select unitid from inserted)
create trigger trigger_insert on student
for delete
as
update class
set 人数=人数-1
where unitid=(select unitid from deleted)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询