Thursday, March 31, 2016

MySQL Trigger

CREATE TRIGGER `posttrigger` AFTER INSERT ON `posts`
 FOR EACH ROW INSERT INTO posts2(postTitle, postBody)  VALUES( NEW.postTitle,New.postBody)

Trigger is created on table posts. If data is inserted in posts, some other data (as defined in the trigger) is inserted in 'posts2' table;

No comments:

Post a Comment