Implementation of External table key triggers

Source: Internet
Author: User

The implementation of its own table foreign key trigger currently encounters such a foreign key definition: 't_ gir '. 'tb1 'straint' fk _ 1 'foreign key ('R _ id') REFERENCES 'tb1' ('id ') on delete cascade aims to restrict another field of the table. In this case, CASCADE deletion is unnecessary because it is for the same record of the same table. /* Trigger structure for table 'tb1 '*/DELIMITER $ /*! 50003 drop trigger *//*! 50032 if exists *//*! 50003 'tr _ tb1_before_insert '*/$ www.2cto.com /*! 50003 CREATE *//*! 50017 DEFINER = 'root' @ 'localhost '*//*! 50003 TRIGGER 'tr _ tb1_before_insert 'before insert on 'tb1 'for each row begin set new. r_id = new. id; END */$ DELIMITER; other engines except INNODB can be directly implemented using triggers. Author: yueliangdao0608

Related Article

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.