Last answered:

07 Sept 2020

Posted on:

04 Sept 2020

0

SQL Foreign Constraint - Part II -Cannot drop table 'customers' referenced by a foreign key constraint

07:30:12 Drop table customers Error Code: 3730. Cannot drop table 'customers' referenced by a foreign key constraint 'constraint_1' on table 'sales'. 0.000 sec   How do I get around this issue?
1 answers ( 0 marked as helpful)
Instructor
Posted on:

07 Sept 2020

0
Hi Babatunde! Thanks for reaching out. Most probably, you are having values in a table that is a child table to the customers table, that are still in use. So, MySQL disallows/prevents the customers table from being dropped namely because of this foreign key constraint. To solve the problem, you should delete the relevant piece of data from the child table that prevents you from dropping customers (which is, obviously, the parent one). Hope this helps.
Best,
Martin

Submit an answer