Implementation of external table key triggers _ MySQL
Source: Internet
Author: User
About the implementation of its own foreign key trigger bitsCN.com about its implementation of its own foreign key trigger currently encountered 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 '*/$ /*! 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: yueliangdao0608bitsCN.com
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