创建触发器,当输入某个同学选课成绩时,如果他是少数民族,其成绩自动加5分
Create trigger ScoreInc
On Score
For insert
As
If exists(select *from inserted,Student where inserted.studentNo=Student.studentNo and student.nation<>’汉族’)
Update Score setScore.score=Score.score+5 from inserted,Student
Where inserted.studentNo=Student.studentNo and student.nation<>’汉族’ and inserted.studentNo=Score.studentNo andinserted.courseNo=Score.courseNo
为什么要选Score当基础表 而不是Student当基础表 怎么分析
Update Score setScore.score=Score.score+5 from inserted,Student 这句话 from之后怎么不是Score
student.nation<>’汉族’ 这个是说其它都是少数民族