Re: Separate foreign keys with shared ID space

From: Christian Antognini <christian.antognini_at_trivadis.com>
Date: Sat, 31 Jul 2004 04:11:24 +0200
Message-ID: <410affcf$1_at_post.usenet.com>


  • Post for FREE via your newsreader at post.usenet.com ****

Hi Robert

> It seems like type hierarchies are a common technique in relation
> design. What approaches do people use to provide relational integrity
> in cases like this? Should I add the customer_type column to the
> subtypes and then use composite foreign key?

A PK should have no business meaning. Therefore, I'll not add such a column to the primary key.

Once I solved such a problem with as many parent tables as child tables and then by putting a views that aggregated the information over the different types of customer. Of course it is only a good solution if you rarely query all customers at the same time. Another drawback is that the primary key cannot be guaranteed for the whole customers. But, if you generate the customer id with a sequence, this should not be a problem.

Chris

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

  • Usenet.com - The #1 Usenet Newsgroup Service on The Planet! *** http://www.usenet.com Unlimited Download - 19 Seperate Servers - 90,000 groups - Uncensored -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Received on Sat Jul 31 2004 - 04:11:24 CEST

Original text of this message