i have two tables. in 2nd table i assigned the 1st table primary key as foreign key.

i have two options edit and delete. i can't delete foreign key value and also primary key value in 2nd table.

Recommended Answers

All 4 Replies

you can not remove or delete foreign key data on table 2 which relate both tables. in other words data consistancy Maintaine by PK FK in tables. you have to remove first foreign key constraint.

you can try to do that by executing below query first - SET foreign_key_checks = 0;

Are you talking about deleting a row in the 1st table, so the data in 2nd table should be removed as well???

yes. i think that is good way. you can also re-insert data to your tables.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.