触发器,处理数据约束条件。
某个操作的执行前或者执行后进行更新。
新行代表刚插入数据库的元组。
删除后触发 12345678create trigger timeslot_check2 after delete on timeslot referencing old row as orow for each row when (orow.time_slot_id not in (select time_slot_id from time_slot)) and orow.time_slot_id in (select time_slot_id from section)beginrollbackend类似RESTRCUCT级联限制。
更新前出发 1234567create trigger setnull_trigger before update of takesreferencing new row as nrowfor each row when (nrow='')begin set nrow.grade=null;end对于此sql,可以在表takes之后使用on lt;field name>来指定在哪个字段进行更新时进行触发。
…
可用count()模拟实现。