dbTalk Databases Forums  

Re: Can FK be nullable/optional by design?

comp.databases comp.databases


Discuss Re: Can FK be nullable/optional by design? in the comp.databases forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
BenignVanilla
 
Posts: n/a

Default Re: Can FK be nullable/optional by design? - 12-02-2003 , 07:37 AM







"Bruce Lewis" <brlspam (AT) yahoo (DOT) com> wrote

Quote:
net__space (AT) hotmail (DOT) com (Andy) writes:

General statement: FK should not be nullabe to avoid orphans in DB.

I don't see the reasoning behind this statement. Any column that
references keys to another table should be explicitly specified as such
to avoid orphans.

If that column may sometimes be unknown/unspecified for perfectly valid
records, I see no reason not to make it nullable.
snip

I agree. In fact, I am working on a system right now where we have this case
exactly. We have invoices that may or may not be associated with a contract.
We have FK for the contract number in the invoice table (over simplified for
sake of argument) and it must be, by definition, nullable because business
rules allow for it.


--
BV.
WebPorgmaster - www.IHeartMyPond.com
Work at Home, Save the Environment - www.amothersdream.com




Reply With Quote
  #2  
Old   
DataMan
 
Posts: n/a

Default Re: Can FK be nullable/optional by design? - 12-10-2003 , 09:29 AM







I would characterize a broken relationship (RI enforced through application
code) as an orphan.

Reply With Quote
  #3  
Old   
Eric Junkermann
 
Posts: n/a

Default Re: Can FK be nullable/optional by design? - 12-11-2003 , 05:08 AM



"DataMan" <dataman (AT) ev1 (DOT) net> wrote

Quote:
I would characterize a broken relationship (RI enforced through application
code) as an orphan.
Yes, if the broken relationship was mandatory. In which case you have
either a bug in your application or an unauthorised data change -
which is why you shouldn't be enforcing RI in the application unless
you have no choice, in which case you may be using the wrong DBMS.

Regards,

Eric


Reply With Quote
  #4  
Old   
DataMan
 
Posts: n/a

Default Re: Can FK be nullable/optional by design? - 12-13-2003 , 03:49 PM




"Tobin Harris" <tobin_dont_you_spam_me (AT) breathemail (DOT) net> wrote:

Quote:
Just out of interest, what would you describe as the fundamentals?

Tobes



entities, attributes, and relationships!


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.