why this error ERROR Cannot add or update a child row a foreign key constraint fails

0 votes
create table per( sl_no int UNIQUE NOT NULL, name varchar(22),age int NOT NULL CHECK (age >= 18),city varchar(55),PRIMARY KEY(sl_no));

insert into per values(1,"sakil",19,"kolkata"),(2,"arif",20,"mumbai"),(3,"amit",21,"kolkata"),(4,"avi",20,"delhi"),(5,"suvo",19,"mumbai"),(6,"nurjamal",20,"puna");

create table edu( sl_no int UNIQUE NOT NULL, course varchar(22) NOT NULL,dept varchar(55) NOT NULL,sem varchar(4) NOT NULL,year int NOT NULL, FOREIGN KEY(sl_no) REFERENCES per(sl_no));

insert into edu values(076,"cyber security","ancs","1st",2022),(077,"cyber security","ancs","1st",2022),(078,"cyber security","ancs","1st",2022),(079,"cyber security","ancs","1st",2022),(080,"cyber security","ancs","1st",2022),(081,"cyber security","ancs","1st",2022);
Dec 13, 2022 in Database by abc

edited Mar 4 1 view

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP