#1452– Cannot add or update a child row: a foreign key constraint
fails (schoolzone., CONSTRAINT#sql-10e0_7f2_ibfk_1FOREIGN KEY
(teacherid) REFERENCESteacher(teacherid))
#1452 – Cannot add or update a child row: a foreign key constraint fails
Share
The reason why you are getting the error is because you are inserting a record on table
schoolZonewith value of the columnteacheridthat doesn’t exist on tableteacher. Remember that the table you are inserting the record is dependent on tableteacher.Below is an example that shows how you get the error.