The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Ask
Anybody can ask a question
Answer
Anybody can answer
Vote
The best answers are voted up and moderated by our team

SQL insert statement error

SQL insert statement error

0
Votes
1
Answer

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 Answer

365 Team
0
Votes

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