我正在尝试使用触发器来插入 vlaue。我有 2 个表连接到一起收集问题和论文。问题有这些列(question_id 主键,correct_answer varchar),我已经插入了值
插入问题值(1,“B”)
论文有这些列(Question_id 外键,student_answer varchare,分数整数)
如果 student_answer 等于 correct_answer 然后插入到分数 1 否则 0 触发器应该在插入纸后工作
这是我的触发器代码
create trigger if not exists insert_score after insert on paper
for each row
when (select * from paper,question
where question.question_id = paper.question_id
and question.correct_Answer = paper.student_Answer)
begin
insert into paper (Score) values (1);
end