What's the reputation for the strategy of utilizing some foreign secrets inside a table where basically one are NULL for any given row?
Quite simply, each row requires a foreign answer to one (and just one) of n different possible tables which means you really have the required foreign secrets but basically one are NULL.
(customers of Django may recognize this instead of utilizing a Generic Foreign Key)
The word for that design you are explaining is Exclusive Arc.
Rather, I favor to create one foreign key that references a typical super-table of the n different parent tables.
See my other solutions for polymorphic associations:
- Possible to do a MySQL foreign key to one of two possible tables?
- Referencing foreign keys in the same column
- Why can you not have a foreign key in a polymorphic association?
- In a StackOverflow clone, what relationship should a Comments table have to Questions and Answers?
- How to handle an “OR” relationship in an ERD (table) design?
It could have been simpler having a example, but a typical method to untangle this is just to locate a common super-type for individuals tables. Guess that we've tables
Book, Article, Magazine and today a table needs to have foreign answer to these tables. Utilizing a common super-type
Publicationresolves this. See here for the model and also the similar question/answer.