Re: A foreign key on a self-referring table

From: Dataman <dataman_at_ev1.net>
Date: Thu, 04 Mar 2004 14:06:53 -0000
Message-ID: <104edvtb10qu061_at_corp.supernews.com>


"Andrea Laforgia" <alaforgia_at_despammed.com> wrote:
>Hi all and sorry for my English.
>
>I have a question about foreign-keys.
>
>In a project I'm currently working on, I looked at the database design
>chart (made by other people) and found that some tables have foreign
>keys referring to themselves.
>
>For example:
>
>Table Customers:
>|--------------------------|
>|CustomerID |(PK)
>|--------------------------|
>|Name |
>|City |
>|ZipCode |
>|CustomerID |(FK)
>----------------------------
>
>(That's an example, of course, it's not my real case).
>
>That's quite weird, in my opinion, but I wish to know whether it is
>acceptable, in general, or they are just violating some database
>design principle.
>
>....Thanks!...
>
>--
>Andrea Laforgia
>
>
It is acceptable. It's called a hierarchy. Received on Thu Mar 04 2004 - 15:06:53 CET

Original text of this message