2 deleted 1 character in body
source | link

try this:

delimiter //
CREATE TRIGGER `before_quiz_attempt_delete` BEFORE DELETE ON `Quiz_Attempt`    
FOR EACH ROW 
BEGIN 
INSERT INTO Quiz_Attempt_History (Q_Code, S_Email, Result)
     VALUES (old.Q_Code, old.S_Email, old.Result);  
UPDATE Quiz_Attempt_History QAH 
     SET QAH.C_Code = (SELECT C_Code FROM Quiz_Scope WHERE Q_Code = old.Q_Code), 
         QAH.S_No =   (SELECT S_No FROM Quiz_Scope WHERE Q_Code = old.Q_Code) 
     WHERE QAH.Q_Code=old.Q_Code AND QAH.S_Email=old.S_Email;   
END;END//
delimiter ;

try this:

delimiter //
CREATE TRIGGER `before_quiz_attempt_delete` BEFORE DELETE ON `Quiz_Attempt`    
FOR EACH ROW 
BEGIN 
INSERT INTO Quiz_Attempt_History (Q_Code, S_Email, Result)
     VALUES (old.Q_Code, old.S_Email, old.Result);  
UPDATE Quiz_Attempt_History QAH 
     SET QAH.C_Code = (SELECT C_Code FROM Quiz_Scope WHERE Q_Code = old.Q_Code), 
         QAH.S_No =   (SELECT S_No FROM Quiz_Scope WHERE Q_Code = old.Q_Code) 
     WHERE QAH.Q_Code=old.Q_Code AND QAH.S_Email=old.S_Email;   
END;//
delimiter ;

try this:

delimiter //
CREATE TRIGGER `before_quiz_attempt_delete` BEFORE DELETE ON `Quiz_Attempt`    
FOR EACH ROW 
BEGIN 
INSERT INTO Quiz_Attempt_History (Q_Code, S_Email, Result)
     VALUES (old.Q_Code, old.S_Email, old.Result);  
UPDATE Quiz_Attempt_History QAH 
     SET QAH.C_Code = (SELECT C_Code FROM Quiz_Scope WHERE Q_Code = old.Q_Code), 
         QAH.S_No =   (SELECT S_No FROM Quiz_Scope WHERE Q_Code = old.Q_Code) 
     WHERE QAH.Q_Code=old.Q_Code AND QAH.S_Email=old.S_Email;   
END//
delimiter ;
1
source | link

try this:

delimiter //
CREATE TRIGGER `before_quiz_attempt_delete` BEFORE DELETE ON `Quiz_Attempt`    
FOR EACH ROW 
BEGIN 
INSERT INTO Quiz_Attempt_History (Q_Code, S_Email, Result)
     VALUES (old.Q_Code, old.S_Email, old.Result);  
UPDATE Quiz_Attempt_History QAH 
     SET QAH.C_Code = (SELECT C_Code FROM Quiz_Scope WHERE Q_Code = old.Q_Code), 
         QAH.S_No =   (SELECT S_No FROM Quiz_Scope WHERE Q_Code = old.Q_Code) 
     WHERE QAH.Q_Code=old.Q_Code AND QAH.S_Email=old.S_Email;   
END;//
delimiter ;