J
Jonathan Wood
I just wondered if anyone here has had experience with nullable foreign
keys.
I have a number of items and I want some of the items associated with a user
while other items are not associated with any user. After thinking about
this, it seems like the easiest approach is to put all items in the same
table and give that table a foreign key to the user's table, but allow that
foreign key to be NULL for when the item is not associated with a user.
This seems pretty straight forward but there's a few things that bother me.
Just thought I'd check if anyone sees any potential problems to this
approach.
Thanks.
keys.
I have a number of items and I want some of the items associated with a user
while other items are not associated with any user. After thinking about
this, it seems like the easiest approach is to put all items in the same
table and give that table a foreign key to the user's table, but allow that
foreign key to be NULL for when the item is not associated with a user.
This seems pretty straight forward but there's a few things that bother me.
Just thought I'd check if anyone sees any potential problems to this
approach.
Thanks.