I want to create a trigger in MySQL for the following table such that if the attribute of occurrences is greater than 100 the attribute of status updates to "popular".
The name of the table is trigger
Repo_ID |Occurences |Status
1 | 50 | Normal
2 | 70 | Normal
3 | 190 | Popular
I've tried the following thing. It didnt work. Any suggestions?
CREATE TRIGGER `A` after update
ON `trigger`
FOR EACH ROW BEGIN
IF (new.occurence > 100) THEN
SET new.STATUS = "popular";
ELSE SET new.STATUS = "normal";
END IF;
END