MySQL Triggers | INSERT , DELETE.

preview_player
Показать описание
#MySQLTriggers #LearnWithPassion

Introduction to MySQL triggers:
a trigger is a set of SQL statements that is invoked automatically when a change is made to the data on the associated table. A trigger can be defined to be invoked either before or after the data is changed by INSERT, UPDATE or DELETE statement.Here iam using INSERT and DELETE statements for this video.

CREATE TRIGGER `insert on T2 Users` AFTER INSERT ON `users`
FOR EACH ROW BEGIN

INSERT INTO `t2`.users(id, First_Name, Last_Name) VALUES (NEW.id,NEW.First_Name,NEW.Last_Name);

END

CREATE TRIGGER `Delete on T2 users` AFTER DELETE ON `users`
FOR EACH ROW BEGIN
WHERE OLD.id = id;
END
Рекомендации по теме