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

Clarification on SQL Insert statement exercise 1

Clarification on SQL Insert statement exercise 1

0
Votes
1
Answer

Hi Team, can you please help with this exercise. I get a error while trying to run the code below.
INSERT INTO titles
(
emp_no,
title,
from_date
)
VALUES
(
999903,
‘Senior Engineer’,
‘1997-10-01’
);
 
I get a error code 1452: cannot add or update a child row: a foreign key constraint fails (’employees’,’titles’,CONSTRAINT’titles_ibfk_1’FOREIGN KEY(’emp_no’)REFERENCES’employees(’emp_no’)ON DELETE CACADE).
 
Please help to clarify the issue.

1 Answer

Hi Guys,
 
I have rectified this issue. I missed to include the part of your lecture and just noticed and rectified it. 
 
Please ignore my clarification.
 

Hi Vijay! No worries – actually, thank you for letting us know you can proceed! Should you need further information, please refer to the following thread from the Hub; thank you! – https://365datascience.com/question/error-code-1452-cannot-add-or-update-a-child-row-a-foreign-key-constraint-fails-employees-titles-constraint-titles_ibfk_1-foreign-key-emp_no-references-employees-emp_no-on-delete/

6 months