I am trying to create a very simple MySQL trigger that will run on the insertion or updating of a row on one table (Screws). I thought I had it pretty close however when I run the query to create the trigger, it just fails and says error, nothing to point me in the right direction.
Here is what I have so far, I am just wanting to take the value of two columns within the table and multiply them and then update the result into a third column, I want this to happen whenever a new record is added or edited within this table. I have tried matching some examples I have seen so far as best I can but nothing seems to quite match.
delimiter //
CREATE TRIGGER estimate
AFTER INSERT ON `Screws` FOR EACH ROW
begin
UPDATE Screws SET Quantity = Weight * num_per_ounce;
end;
delimiter ;