add Constraint on database with trigger
Posted
by Am1rr3zA
on Stack Overflow
See other posts from Stack Overflow
or by Am1rr3zA
Published on 2010-04-19T10:57:07Z
Indexed on
2010/04/20
7:43 UTC
Read the original article
Hit count: 310
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.
© Stack Overflow or respective owner