Share my teacher’s artificial intelligence tutorial! Zero basis, easy to understand! http://blog.csdn.net/jiangjunshow
You are also welcome to reprint this article. Share knowledge, benefit the people, and realize the great rejuvenation of the Chinese nation!
1. Execute DELETE to report an error
mysql> delete from JBPM4_EXECUTION;
ERROR 1451 (23000): Cannot delete or updatea parent row: a foreign key constraint fails (`jbpm_db`.`JBPM4_EXECUTION`,CONSTRAINT `FK_EXEC_INSTANCE` FOREIGN KEY (`INSTANCE_`) REFERENCES`JBPM4_EXECUTION` (`DBID_`))
mysql>
The table has a foreign key, so delete is wrong. Here are two ways to handle it:
(1) Temporary setting of foreign key failure
(2) Delete the table data of the foreign key involved in the table
2. Handling scheme of foreign key failure
mysql> SET FOREIGN_KEY_CHECKS = 0; # Temporarily set foreign key invalidation Query OK, 0 Rows affected (0.00 SEC) MySQL> Mysql> delete from JBPM4_EXECUTION; # Execute delete operation Query OK, 110 Rows Affected (0.00 SEC) MySQL> Mysql> SET FOREIGN_KEY_CHECKS = 1; After the # operation restore foreign keys Query OK, 0 Rows affected (0.00 SEC) MySQL> td> tr> tbody> table> 3, delete the foreign key table data out of the scheme First, query all the foreign key situations involved in table lock, and query THE SQL as follows: The
Executing the query will see the following foreign key: |