Executing the DELETE statement throw an error about foreign key constraint failing. Why ?

It means the data that you’re trying to delete is still present in another table. Like if you have a table for colleges and a table for students, which contains the ID of the college they go to, running a DELETE on a college table will fail if the students table still contains people enrolled at that college.

To delete the offending data first, and then delete the college. Quick way would involve running SET foreign_key_checks = 0 before the DELETE command, and setting the parameter back to 1 after the DELETE is done. If your foreign key was formulated with ON DELETE CASCADE, the data in dependent tables will be removed automatically.