I have a simple table called 'followers':
id fb tw sum
1 2 4
2 6 5
3 4 8
I want to create a trigger such that after inserting data into the 'fb' and 'tw' columns, the fourth colum 'sum' will be the sum of fb+tw.
Here is my code for the trigger:
USE `my_database`;
DELIMITER $$
CREATE TRIGGER `followers_AINS` AFTER INSERT ON `followers` FOR EACH ROW
BEGIN
UPDATE sum SET sum=fb+tw
END
DELIMITER;
I keep getting a DDL error.