Re: Can FK be nullable/optional by design?
Date: 10 Dec 2003 05:04:55 -0800
net__space_at_hotmail.com (Andy) wrote in message news:<edb90340.0311301114.19718061_at_posting.google.com>...
> Hi All!
> General statement: FK should not be nullabe to avoid orphans in DB.
Where did this statement come from? The idea of an orphan belongs to network and hierarchical databases (old fashioned) or to object-oriented databases (allegedly new), where the only way to get to a record might be through its parent record. In a relational database there is no such thing as an orphan.
You can find your "orphans" by some equivalent of (client where groupcode not present) (worded that way to keep away from arguments about NULLS).
In your example, what you have is
A client may be a member of at most one group.
If you meant to have
A client must be a member of exactly one group.
then (in your example) you would have to use NOT NULL.
Eric Received on Wed Dec 10 2003 - 14:04:55 CET