views:

67

answers:

2

I have two tables where foreign key cannot be set so is it necessary to assign foreign key any way?

+1  A: 

You never have to define foreign keys, but it's best practice to do so to improve the consistency of your data.

marcgg
A: 

No, it's not necessary, but usually it's convenient to have the database checks data integrity for you. Otherwise you'll need to enforce data integrity on application level.

egorius
you need to enfore data integrity on application level whether or not the database supports constraints since if you dont do that you'll get errors because of constraints in your application.
Numenor