mysql error #1452 appearing when trying to add a constraint
Posted
by
user1701484
on Stack Overflow
See other posts from Stack Overflow
or by user1701484
Published on 2012-09-30T09:31:18Z
Indexed on
2012/09/30
9:37 UTC
Read the original article
Hit count: 255
I am trying to alter a table so That I can add a foreign key constraint in mysql database:
ALTER TABLE `Question` ADD CONSTRAINT `FK_question` FOREIGN KEY (`QuestionId`)
REFERENCES `Image_Question` (`QuestionId`) ON DELETE CASCADE ;
Problem is that it is giving me this error:
1452 - Cannot add or update a child row: a foreign key constraint fails (mobile_app
.'#sql-4517_15241'>, CONSTRAINT
FK_question
FOREIGN KEY (QuestionId
) REFERENCESImage_Question
(QuestionId
) ON DELETE CASCADE)
What does this error actually mean and what are the possible solutions I might have to undertake in order to fix this?
© Stack Overflow or respective owner