Re: Anybody for Automated Comparative Normal Form?
Date: 19 Nov 2004 04:00:55 -0800
Message-ID: <1100865655.553280.171620_at_c13g2000cwb.googlegroups.com>
Kenneth Downs wrote:
> This brings the problem back to what I have called "arbitrary
constraints"
> in recent weeks, but which should probably be called "comparative
> constraints", because this is what they keep turning into. It should
be
> possible to demonstrate that by using automation, one can reduce any
> arbitrary constraint to a comparison constraint.
You can demonstrate that it is so like this:
1) Take any desired integrity constraint of whatever complexity
2) Define a query to find violations of this constraint:
SELECT ... FROM ... WHERE <violates constraint>
3) The constraint can be expressed as requiring that:
SELECT COUNT(*) FROM (SELECT ... FROM ... WHERE <violates
constraint>) = 0
4) Using triggers or some other mechanism (e.g. materialized view),
automate that the result of the query in (2) is stored in some column C
of some table T
5) Add a constraint to T: CHECK(C = 0)
Received on Fri Nov 19 2004 - 13:00:55 CET
