Reputation: 25
I have a newbie question here in terms of database design and I've noticed 2 options. 1) include the foreign key constrain in the create table block 2) create table then Alter table by ADD CONSTRAINT FOREIGN KEY
Appreciate your experienced view on this
Upvotes: 0
Views: 489
Reputation: 36621
1. include the foreign key constrain in the create table block
self explanatory, You're creating foreign key constraint in create table there are not records.
2) create table then Alter table by ADD CONSTRAINT FOREIGN KEY
If you don't have any records in table then this will behave as 1. If you've any records in tables then you need to take care whether the available records doesn't violates the foreign key constraints.
Upvotes: 1