Problems creating TRIGGER in MySQL -


i first time using trigger concept in mysql workbench below query,

first created people table using below query,

create table people (age int, name varchar(150)); 

then used below query trigger

delimiter  create trigger agecheck before insert on raptor1_5.people each row if new.age < 0 set new.age = 0; end if;  delimiter ; 

but agecheck trigger not creating people table. not show error message when run query.

here table images,

enter image description here

updated : based on answer

enter image description here

try this.

use `raptor1_5`;  delimiter $$  drop trigger if exists raptor1_5.agecheck$$ use `raptor1_5`$$ create trigger agecheck before insert on people  each row  begin  if new.age < 0     set new.age = 0;   end if; end$$ delimiter ; 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -