 /*
  * 当插入或更新Submission时，若得分不在0～100之间，将其置为-1,表示需重新检查一遍
  * 更新的情况只有当goal为-1时，进允许更新这一列
- */
-create trigger `Submission_Check_Tri` before insert update on `Submission`
+ * 不能写成insert or update，神奇的报错-_-|||
+ */
+create trigger `Submission_Check_Insert_Tri` before insert on `Submission`
+for each row
+begin
+    if ((new.`goal` > 100.0) or (new.`goal` < 0.0))
+    then
+        set new.`goal` = -1;
+    end if;
+end$$
+create trigger `Submission_Check_Update_Tri` before update on `Submission`
 for each row
 begin
     if ((new.`goal` > 100.0) or (new.`goal` < 0.0))

    `Extra`       varchar(200)    null,
    primary key (`UId`),
    unique index `nickname_Unique` (`Nickname` asc),
    unique index `email_Unique` (`Email` asc)
    check (`Trust` >= 0 and `Trust` <= 10)
    check (`Status` == 0 or `Status` == 1)
);

/*

create trigger `User_Insert_Tri` after insert on `UserInfo`
for each row
begin
    if ((new.`Status` != 0 ) or (new.`Status` != 1))
    then
        update `UserInfo` set `Status` = 0 where `UId` = new.`UId`;
    end if;

    insert into UserStatistics (`UId`) values(new.`UId`);
end$$

