Re: A foreign key on a self-referring table

From: Gianluca Hotz <ghotz_at_alphasys.it>
Date: Sat, 6 Mar 2004 18:12:45 +0100
Message-ID: <c2d0r1$1rrm52$1_at_ID-184953.news.uni-berlin.de>


AL> Thank you for all your answers.

AL> I was imagining it was weird just because I assumed that,
AL> whether, for a strange reason, a record pointed to itself,
AL> the DBMS would not allow to delete it.

Hi Andrea,
first of all let me make a small joke and ask you not to talk about pointers in this newsgroup :-)

If you read my other posting, you will recognize that the
"record referencing itself" it's really just another way to
solve the problem of entering missing informations for the
"roots of the hierarchy".

Whether is a good or a bad attempt you choose, but the proposition for such a "record" would be something like:

"Customer identified by number 100 has name ..., lives in
city ... and is managed(?) by customer with number 100"

Which is probably not a true statement.

AL> If I had, for instance:
AL>|--------------------------|
AL>|CustomerID = 100          |(PK)
AL>|--------------------------|
AL>|Name = ....               |
AL>|City = ...                |
AL>|ZipCode = ...             |
AL>|CustomerID = 100          |(FK)
AL>----------------------------

AL> Would the DBMS let delete that record ?

Yes.

--
Gianluca Hotz
Associate mentor
Solid Quality Learning
More than just Training
www.SolidQualityLearning.com 
Received on Sat Mar 06 2004 - 18:12:45 CET

Original text of this message