mysql--Trigger

Source: Internet
Author: User

Trigger an action when a table is being hacked with a trigger

1. Basic statement (also need to modify delimiter)

#插入前: Create Trigger T1_i_b (trigger name) before insert on  info (table name) each rowbegin    ... end# insert create TRIGGER t1_i_a (trigger name) After insert on  info (table name) each rowbegin ...    end# before delete create trigger T1_d_b (trigger name) before delete on  info (table name) each R Owbegin.    end# After delete create trigger t1_d_a (trigger name) after delete on  info (table name) each Rowbegin    ... end# before update create Trigger T1_u_b (trigger name) before update on  info (table name) each Rowbegin    ... end# after update create TRIGGER t1_u_a (trigger name) after update On  info (table name) each rowbegin ...    end

Note: New represents the data row that will be inserted, and old indicates the data row to be deleted.

//  for Each rowbegin     if ' ASD ' then    #if the number using =, the string uses = =       INSERT into info (name) VALUES ('aa'  )   end Enddelimiter;

mysql--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.