Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Separate foreign keys with shared ID space
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
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=