Featured
-
No Featured Found!
Tags
What is FOREIGN KEY Constraint in MySQL?
Note that the "P_Id" column in the "Orders" table points to the "P_Id" column in the "Persons" table.
In MySQL, the FOREIGN KEY on one table is used to point a PRIMARY KEY in another table.
We have two tables with the following values.
...
ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint
This error generally comes when we want to delete child table row. To solve this problem we have to disable the
foreign key checks.
SET FOREIGN_KEY_CHECKS=0;
Now you can fire your query.
DELETE FROM TABLE WHERE ID = 'Somthing';
You can ena...