
what could be the problem here?help me please 🙂 and please explain hehe thanks! 🙂
Advertisement
Answer
because you have set FOREIGN KEY constraint on your table category.
Insert into ads values (1, 'pd'); // successful DELETE from ads // successful INSERT INTO category VALUES (1,1,'a'); // failed!
the third query failed because value for adid which is 1 doesn’t exist anymore on table category. In other words, the value for adid on table category is depended on the values for ID on table ads.