Table design problem
From: Roy Hann <rhann_at_globalnet.co.uk>
Date: Mon, 31 Mar 2003 10:42:39 +0000 (UTC)
Message-ID: <b6962v$bf6$1_at_sparta.btinternet.com>
I think I want to create a couple of subtype entities in an SQL database. In this database customers may be either of two subtypes: Individuals or Corporations. (Furthermore, Corporations can have another subtype, namely Non-profits, but let's ignore those for the moment.)
Date: Mon, 31 Mar 2003 10:42:39 +0000 (UTC)
Message-ID: <b6962v$bf6$1_at_sparta.btinternet.com>
I think I want to create a couple of subtype entities in an SQL database. In this database customers may be either of two subtypes: Individuals or Corporations. (Furthermore, Corporations can have another subtype, namely Non-profits, but let's ignore those for the moment.)
I have no problem setting up RI constraints on the subtype tables to ensure that there is a corresponding customer entity in the Customers super-table, but I am having trouble devising a way to ensure each entity in the Customers table ends up with exactly one corresponding entity in either the Individuals table or the Corporations table, but not both. How do people normally handle this? I seem to need some kind of mutual exclusion constraint between the subtypes.
Procrustes Received on Mon Mar 31 2003 - 12:42:39 CEST