Resolved: What is the explanation for not truncate the table?

1 answers ( 1 marked as helpful)
Hi Mohamed!
Thanks for reaching out.
You cannot TRUNCATE a table that has FK constraints applied on it (TRUNCATE is not the same as DELETE). Please, use the following code:
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE table departments;
SET FOREIGN_KEY_CHECKS = 1;
Hope this helps.
Best,
Tsvetelin