Re: Requirements for update languages?

From: Vadim Tropashko <vadim.tropashko_at_oracle.com>
Date: Tue, 12 Nov 2002 16:23:59 -0800
Message-ID: <3DD19B9F.95099150_at_oracle.com>


Lauri Pietarinen wrote:

> But wait a minute!
>
> > The other way to legitimate bags is a theory of distributions: each
> > distribution is a generalization of a bag. Cartesian Product is just
> > a product of 2 distributions. Given
> >
> > T1: {0->2} and T2: {1->1, 2->1}
> >
> > then
> >
> > T1*T2 = {<0,1> -> 2, <0,2> -> 2}
> >
> >
> > Note, that aggregation fits naturally into distribution theory, and
> > not
> > into logic or set theory.
>
> The same can be expressed in terms of sets as following:
>
> The tables
> T1 T2
> +----+ +----+
> ¦ C1 ¦ ¦ C2 ¦
> +----¦ +----¦
> ¦ 0 ¦ ¦ 1 ¦
> ¦ 0 ¦ ¦ 2 ¦
> +----+ +----+
>
> have been converted into
>
> T1' T2'
> +---------+ +---------+
> ¦ C1 ¦ Q ¦ ¦ C2 ¦ Q ¦
> +----+----¦ +----+----¦
> ¦ 0 ¦ 2 ¦ ¦ 1 ¦ 1 ¦
> +---------+ ¦ 2 ¦ 1 ¦
> +---------+
>
>
> and with the help of an extra table
>
>
> N
> +----+
> ¦ I ¦
> +----¦
> ¦ 1 ¦
> ¦ 2 ¦
> ¦ 3 ¦
> ¦ 4 ¦
> ¦ 5 ¦
> ¦ etc...
> +----+
>
> we can write (using SQL...)
>
> SELECT T1'.C1, T2'.C2
> FROM T1',
> T2',
> N N1,
> N N2
> WHERE T1'.Q <= N1.I AND
> T2'.Q <= N2.I
>

Is there a typo in your example -- missing quantities. Also you need a "distinct" keyword whenever referring to sets. Also it seems that the table of integers is unnecessary:

SQL>select distinct C1, C2, T1.Q * T2.Q from   2 (select 0 C1, 2 Q from dual) T1,
  3 (select 1 C2, 1 Q from dual
  4 union
  5 select 2 C2, 1 Q from dual) T2

        C1 C2 T1.Q*T2.Q
---------- ---------- ----------

         0          1          2
         0          2          2
Received on Wed Nov 13 2002 - 01:23:59 CET

Original text of this message