Home > database >  MySQL trigger not functioning correctly
MySQL trigger not functioning correctly

Time:06-19

I currently working my AWS RDS MySQL through R notebook.

I have a table like this:

create table t (
  tid INTEGER NOT NULL,
  fruit ENUM('A', 'B', 'C') NOT NULL,
  PRIMARY KEY(tid)
);

With a trigger like this

DELIMITER \\

CREATE
TRIGGER fruit_on_insert     
BEFORE INSERT ON t
FOR EACH ROW
BEGIN
  IF NEW.fruit LIKE "%apple%" THEN
    SET NEW.fruit = 'A';
  ELSEIF NEW.fruit LIKE "           
  • Related