Disabling foreign key checks

  Snippets, Database, MySQL snippets

It sucks, but sometimes ya gotta.

You can’t DROP multiple tables, a parent table or a child table until you disable foreign key checks four your current database. Or for that matter, TRUNC the table, either.

To disable/enable foreign key checks, use the following syntax. (Don’t ever disable @@GLOBAL, unless you’re really irritated and have lost your mind)