A foreign key on a self-referring table

From: Andrea Laforgia <alaforgia_at_despammed.com>
Date: Thu, 4 Mar 2004 11:50:57 +0100
Message-ID: <c271gq$1q2qdf$1_at_ID-221370.news.uni-berlin.de>



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
Received on Thu Mar 04 2004 - 11:50:57 CET

Original text of this message