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

后端 未结 21 1748
野性不改
野性不改 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:51

    you should add data from REFERENCES KEY in PRIMARY TABLE to FOREIGN KEY in CHILD TABLE
    it means do not add random data to foreign key ، just use data from primary key that is accessable

    description of data in foreign key

提交回复
热议问题