Excuse me I have a dilemma I want to update data from the table "f_posts" of the columns "ID" and "post_title" to the table "f_quiz" in the columns "id_quiz" and "quiz" but do it automatically without repeating existing data in mysql . This is my query to insert the data, but I would like a trigger to update it without repeating the records.
INSERT INTO f_quiz (`Id_quiz`,`quiz`) SELECT `ID`,`post_title`FROM f_posts;
UPDATE EXAMPLE (SYNTAX IS WRONG)
DROP TRIGGER IF EXISTS `dato`;
DELIMITER $$
CREATE TRIGGER `dato`
AFTER INSERT ON `f_posts`
FOR EACH ROW
BEGIN
UPDATE INTO `f_quiz` (`Id_quiz`,`quiz`) SELECT (NEW.`ID`,NEW.`post_title`);
END$$
DELIMITER ;
Any idea how to do it, if not you can with a Tigger, how would you do it with a manual query???
Try defining your trigger like this:
Checks can be performed on this dataset:
And with this test insert: