Re: Translating constraints to RM Terms
Date: Mon, 06 Jun 2005 08:05:36 -0400
Message-Id: <2uqdn2-6ml.ln1_at_pluto.downsfam.net>
Jonathan Leffler wrote:
>> I'm wondering if some RM theorist might express something for me. >> >> Consider table X with columns A and B. There is a constraint that A must >> be >> less than B. While we discuss such constraints every day, I realize I do >> not know how to express such constraints in relational terms. >> >> For instance, A is actually a domain, as is B, but the constraint A < B >> must in fact be part of the very definition of the domain A, and here we >> are defining one domain in terms of another.
>
> A is a 'column' or attribute; it is defined on a domain, but (except in
> Codd's 1970 paper), columns are different from domains. A domain is the
> data type.
OK.
>
> If A and B are attributes that must be compared (constrained) as you
> suggest, they would normally be the same type (defined on the same
> domain).
OK.
>
> Don't forget that a domain defines the complete set of values that can
> be stored in an attribute defined on that domain. If you have a domain
> of negative integers - call it A - and a domain of positive integers -
> call it B - then you can infer that all values in domain A are smaller
> than all values in domain B.
>
> So, I reject the contention that 'A < B' must be part of the definition
> of domain A, and I'm far from convinced that we are defining one domain
> in terms of another.
OK.
>
>> I realized I have not seen this >> disccussed in the year or so I have been a regular here. Is defining one >> domain in terms of another allowed and considered trivial, no big deal? >> Is it actually not allowed and this is some SQL alteration of true RM?
>
> It depends in part to whom you speak. To compare two values, there must
> be a suitable comparator. The simplest cases expect to compare two
> values of the same type. In practice, SQL DBMS usually provide numerous
> implicit conversions such that you can 'compare' two values of different
> types - because the DBMS actually converts one or both values so that
> they can be compared.
>
Then I guess my question is restated, does the RM have anything to say about defining one column in terms of another? While the constraint is generally expressed and accepted as existing as a property of the *table*, is it not in fact a fundamental property of COLUMN A?
-- Kenneth Downs Secure Data Software, Inc. (Ken)nneth_at_(Sec)ure(Dat)a(.com)Received on Mon Jun 06 2005 - 14:05:36 CEST
