mysql - SQL Error 1452: Cannot add or update child row -


I am trying to add an existing key to a foreign key named OrderSubbl. I've added a new column called Approved, like:

  Alternate table is not countless by ORDERTBL ADD approved BIGINT; After that, I tried to set it as a foreign key:  
  Add an optional table order. Approved Accepted Foreign Next Key (Accepted) Records Employee Employee (Employee);  

but I continue

Error 1452: hair row can not be added or updated

What am i doing Should I set the field as accepted instead of the foreign key?

While defining

order table order TBL is approved by BIGINT Not countless;

then can not be accepted can not be null . The default value will be set which is 0 .

Then you apply a foreign key to employee TB . This means that the DB checks that accepted has only those values ​​which are in the employeeby . But that is not the case. The value is 0 .

Allow either null to accepted and set the value to the value later or set the correct value before adding the foreign key.


Comments

Popular posts from this blog

Editing Python Class in Shell and SQLAlchemy -

import - Python ImportError: No module named wmi -

uislider - In a MATLAB GUI, how does one implement a continuously varying slider from a GUIDE created .m file? -