Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: Can FK be nullable/optional by design?

Re: Can FK be nullable/optional by design?

From: Eric Junkermann <eric_at_deptj.demon.co.uk>
Date: 10 Dec 2003 05:04:55 -0800
Message-ID: <70568f73.0312100504.4560e16c@posting.google.com>


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.

Regards,

Eric Received on Wed Dec 10 2003 - 07:04:55 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US