MySQL (trigger Trigger)

Source: Internet
Author: User

Drop trigger IF EXISTS T_trigger;

Create Trigger T_trigger
Before insert on AAA for each row
Begin
INSERT into Readandwrite_test.user (time) VALUES (new.timeline);
End
/*
Insert: Activates the trigger when inserting a new row into the table, for example, through the INSERT, LOAD data, and replace statements.
Update: Activates a trigger when a row is changed, for example, through an UPDATE statement.
Delete: Activates the trigger when a row is deleted from the table, for example, through the Delete and replace statements.
*/
--problems that may be encountered
--If you are insert/update in the trigger with the data you just inserted, it will cause a loop call. For example:
--Create TRIGGER test before update on test for each row update test set new.updatetime = Now () where id=new.id; END
--Should use set:
Create trigger test before update on test for each row set new.updatetime = Now (); END

MySQL (trigger Trigger)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.