in Databases retagged by
438 views
0 votes
0 votes
what is the advantage of keeping the Foreign Key null as we know if we make the Foreign Key null we cant reference it again so thats a disadvantage ......so there must be some advantage which outweighs this disadvantage so whats that advantage
in Databases retagged by
438 views

1 comment

have a look here,you get to know both advantage and disadvantage.

http://stackoverflow.com/questions/83147/whats-wrong-with-foreign-keys
0
0

1 Answer

2 votes
2 votes
suppose two table EMPLOYEE(eid,ename) and DEPARTMENT(Did,Dname) and now we make eid as a foreign key , now if we delete any Eid from EMPLOYEE and that Eid was refrenced by foriegn key of DEPARTMENT table then to maintain refrential integrity we hav to also delete that coressponding refrenced key from DEPARTMENT.

but if we donot want to loss data of DEPARTMENT table so instead of deleting that refrenced key of foriegn key we put null values , by this we do not loss the data of DEPARTMENT table