expressing one-or-more constraint structurally
From: Marshall Spight <mspight_at_dnai.com>
Date: Sat, 26 Jun 2004 14:47:00 GMT
Message-ID: <E%fDc.99863$Hg2.52910_at_attbi_s04>
Hi all,
Date: Sat, 26 Jun 2004 14:47:00 GMT
Message-ID: <E%fDc.99863$Hg2.52910_at_attbi_s04>
Hi all,
When one wants to express a cardinality constraint on one item vs. another, being able to do it structurally is the best approach. The most basic example is one-to-many. If, for each a in A, you have 0 or more b in B, then have B have, in addition to its own primary key, a foreign key to A.
If each a:A has zero-or-one b:B, then have B have an attribute that is both the primary key of B and a foreign key to A.
What if one wants to express a one-or-more constraint? For each a:A there exists at least one b:B? One could always write a check constraint, but that is not as desirable as a structural way to express the same.
Any ideas?
Marshall Received on Sat Jun 26 2004 - 16:47:00 CEST