Re: Can these constraint be implemented in an RDBMS ?

From: Mikito Harakiri <mikharakiri_at_iahu.com>
Date: Tue, 2 Mar 2004 09:13:53 -0800
Message-ID: <qq31c.23$4E5.421_at_news.oracle.com>


"Alfredo Novoa" <alfredo_at_ncs.es> wrote in message news:4044793f.9804438_at_news.wanadoo.es...
> Here is a solution in Tutorial D I typed in a hurry and I have not
> checked, so I supose it is flawed O:-)
>
> var Customers relation { Customer Char } key { Customer };
>
> var Accounts relation { Account Char, Customer Char, Amount Numeric }
> key { Account };
>
> var Sets relation { Set Char } key { Set };
>
> var SetMinimums { Set Char, MinimunAmount Numeric }
> key { Set }
> foreign key { Set } references Set;
>
> var SetAccounts { Set Char, Account Char }
> key { Set, Account }
> foreign key { Set } references Sets;
>
> var IndividualAccounts view
> Accounts { Account } minus SetAccounts { Account };
>
> var SetAccountsAmount view
> summarize SetAccounts join Accounts per SetAccounts { Set } add
> Sum(Amount) as Amount;
>
> create constraint MaxAmount
> IsEmpty(Accounts where Amount > 100000000);
>
> create constraint IndividualAccountsNotNegative
> IsEmpty((Accounts join IndividualAccounts) where Amount < 0);
>
> create constraint SetAccountsNotNegative
> IsEmpty(SetAccountsAmount where Amount < 0);
>
> create constraint MinimumAmount
> IsEmpty(SetAccountsAmount join SetMinimums where Amount <
> MinimumAmount);

What is the big deal of translating this into SQL? Would SQL null and bag deficiencies somehow show up? I would like to see that.

We would have to make an assumption that SQL allows subqueries inside check constraints, of course, but the point is that devising a syntax for writing constraints is one matter, while implementation challenges is completely different animal. Received on Tue Mar 02 2004 - 18:13:53 CET

Original text of this message