ERROR 1452: Cannot add or update a child row: a foreign key constraint fails

后端 未结 21 2033
野性不改
野性不改 2020-11-22 07:01

I have created tables in MySQL Workbench as shown below :

ORDRE table:

CREATE TABLE Ordre (
  OrdreID   INT NOT NULL,
  OrdreDato DA         


        
21条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-22 07:44

    You must delete data in the child table which does not have any corresponding foreign key value to the parent table primary key .Or delete all data from the child table then insert new data having the same foreign key value as the primary key in the parent table . That should work . Here also a youtube video

提交回复
热议问题