How does this work ? Does mysql invoke BEFORE INSERT trigger only in case of inserts or everytime an insert or update happens if the query to be run is as follows "
INSERT INTO tSomething VALUES (...) ON DUPLICATE KEY UPDATE ......
I want to update a column's value depending upon other col's values when inserting a row. However, I don't want this behaviour for updates. The query which will be executed always would be the one mentioned above. I chose INSERT AFTER for this. However, I can't update a col using AFTER INSERT TRIGGER as
SET NEW.score = NEW.score1 + NEW.score2 ;
I read somewhere that BEFORE INSERT trigger in this case would allow triggers to be fired everytime when above query is executed. Is this true ? If yes, how do I solve this problem using a trigger.