Getting error in Mysql when trying to insert values
19:15:41 insert into titles ( emp_no, title, from_date ) values ( 999903, 'Senior Engineer', '1997-10-01' ) 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 CASCADE) 0.000 sec
How to solve this error?
1 answers ( 0 marked as helpful)
Hi Tripti!
Thanks for reaching out.
Please refer to the following thread for an explanation. Thank you.
https://365datascience.com/question/error-code-1452-cannot-add-or-update-a-child-row-insert-statement-exercise/
Hope this helps.
Best,
Martin
Best,
Martin