A foreign key definition: 't_girl '. 'tb1 'straint' fk _ 1 'FOREIGNKEY ('R _ id') REFERENCES 'tb1' ('id') ONDELETECASCADE is used to restrict another field of the user.
A foreign key definition: 't_girl '. 'tb1 'straint' fk _ 1 'FOREIGNKEY ('R _ id') REFERENCES 'tb1' ('id') ONDELETECASCADE is used to restrict another field of the user.
A foreign key definition is as follows:
'T_ gir'. 'tb1'
CONSTRAINT 'fk _ 1' foreign key ('R _ id') REFERENCES 'tb1 '('id') ON DELETE CASCADE
The purpose is to restrict another field of your own. The Hong Kong server, in fact, it seems that 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;
We can use triggers for other engines except INNODB.
This article is from "god, let's see it !" Blog, Hong Kong server, please be sure to keep this source
, Virtual host