Last answered:

02 May 2020

Posted on:

01 May 2020

0

SQL insert statement error

In the exercise of the sql course under the insert statement lecture 1, I encountered an error stating MySQL error 1452 - Cannot add or update a  child row: a foreign key constraint fails. I ran the solution to the exercise provided by the course yet I still encountered same error message. Please how do solve this problem as I wish to be clear on what ever I am doing before moving on. Thank You.

MySQL error 1452 - Cannot add or update a child row: a foreign key constraint fails?

1 answers ( 0 marked as helpful)
Instructor
Posted on:

02 May 2020

0
Hi Mark! Thanks for reaching out. You may have missed adding record corresponding to employee 999903 in the 'employees' table first. Please do that, since the 'employees' and 'salaries' tables are interconnected. Hope this helps.
Best,
Martin

Submit an answer