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)
可能要分成两个触发器,insert,delete触发器