Points To Remember
  • A foreign key is a key that is a primary key in some another and is used to maintain a relationship with this table.
  • Foreign key constraint failure occurs when we are trying to assign a value to a foreign key, that does not exist in the other table of which it is primary key.
Solution : How to ignore Foreign key constraint failure
When you need to avoid foreign key constraints, you can do
When you again need to set foreign key constraints on you can,
Note : This is not recommended
If you are trying to insert some data to your tables when your constrains are off, you can end up adding raw data or incorrect data to the tables due to which you application may suffer.
So it is advised that you use it only when it is required with high priority and where you are sure that you are not messing up with your table relations and mappings.