add Constraint on database with trigger
- by Am1rr3zA
Hi,
I have 3 tables (Student, Course, student_course_choose(have field grade)) I defined a view on these 3 tables that get me an Average of the each student. I want to have constraint(with trigger) on these view(or on the table that need it) to limit the average of each student between 13 and 18.
I somewhere read that I must use foreach statement(instead of foreach row) on trigger because when I decrease some grade of special student and his/her average become less than 13 they don't give me error (because later I increase grade of another his/her course ).
how must I wrote this Trigger? (I want to implement aprh for testing trigger)
note:I can write it in SQL server, oracle or Mysql no diff for me.