Home > database >  Delete the insert SQL data, failure by foreign key constraints, solution:
Delete the insert SQL data, failure by foreign key constraints, solution:

Time:11-24

Before insertion or deletion to disable the foreign key constraints:
The set foreign_key_checks=0;

After the insert or delete operation, to enable foreign key constraints:
The set foreign_key_checks=1;


Check the value of the current FOREIGN_KEY_CHECKS, can use the following command:
SELECT @ @ FOREIGN_KEY_CHECKS;

CodePudding user response:

Thanks for sharing, can write blogs

CodePudding user response:

reference 1/f, gypsy song response:
thanks for sharing, can write blog

Ah? What's the difference?
I just put these records, convenient later his view,
There is a place of line,

CodePudding user response:

refer to the second floor sunset light response:
Quote: refer to 1st floor gypsy song response:
thanks for sharing, can write blog

Ah? What's the difference?
I just put these records, convenient later his view,
There is a place of line,

Of course it doesn't matter to you, but is a bother to BBS other friend,
BBS is used to discuss the problem, feel free to post and influence the quality of the BBS

CodePudding user response:

That how to writing a blog on the APP? Not found, please feel free to comment,

CodePudding user response:

reference gypsy song reply: 3/f
Quote: refer to the second floor of the sunset light response:

Quote: refer to 1st floor gypsy song response:
thanks for sharing, can write blog

Ah? What's the difference?
I just put these records, convenient later his view,
There is a place of line,

Of course it doesn't matter to you, but is a bother to BBS other friend,
BBS is used to discuss the problem, feel free to post and affect the quality of the BBS

That how to writing a blog on the APP? Not found, please feel free to comment,

CodePudding user response:


Didn't find the blog App capabilities, with mobile browser directly

CodePudding user response:

Excuse me, is this why

CodePudding user response:

refer to 7th floor Nyinc response:
could you please tell me, what reason is this?

Because of the foreign key constraints, the data were correlation of bond together, so they are not allowed to casually modify data

CodePudding user response:

Can do cascade ~ ~

Reference: https://blog.csdn.net/yole_grise/article/details/16879383

CodePudding user response:

refer to the eighth floor of the sunset light response:
Quote: refer to 7th floor Nyinc response:
could you please tell me, what reason is this?

Because of the foreign key constraints, the data were correlation of bond together, so they don't allow casual modify data

Thank you very much

CodePudding user response:

To disable the foreign keys, handle and then enable foreign keys
  • Related