delimiter $$
CREATE trigger triggername before/after INSERT/UPDATE/DELETE ON tablename
FOR each
ROW
BEGIN
sql query
END
Example:
delimiter $$
CREATE trigger myfirsttrigger before INSERT ON emp
FOR each
ROW
BEGIN
INSERT INTO department VALUES ('', NEW.name);
END
No comments:
Post a Comment