Re: Extending my question. Was: The relational model and relational algebra - why did SQL become the industry standard?

From: Bob Badour <bbadour_at_golden.net>
Date: Thu, 13 Feb 2003 18:47:32 -0500
Message-ID: <4uW2a.1409$0G3.168661119_at_mantis.golden.net>


"Mikito Harakiri" <mikharakiri_at_ywho.com> wrote in message news:irT2a.10$O%2.40_at_news.oracle.com...
> "Lauri Pietarinen" <lauri.pietarinen_at_atbusiness.com> wrote in message
> news:3E4B8137.2080204_at_atbusiness.com...
> > < quotes from book Hector Garcia-Molina, Jeffrey D. Ullman, and
> > Jennifer Widom, DATABASE SYSTEM IMPLEMENTATION>
> >
> > [Relational] algebra was originally defined as if relations were sets
> > [sic!--italics added].Yet relations in SQL are really bags ... Thus, we
> > shall introduce relational algebra as an algebra on bags.
> >
> > ...
> >
> > For instance, you may have learned set-theoretic laws such as A
> > INTERSECT (B UNION C) = (A INTERSECT B) UNION (A INTERSECT C), which is
> > formally the "distributive law of intersection over union." This law
> > holds for sets, but not for bags.
> >
> > < quotes from book/ >
>
> Therefore, the idea here is that Set Algebra is superior to Bag Algebra?
Not
> for aggregates:

>

> PROJECTION*AGGREGATE != AGGREGATE*PROJECTION
>

> for example
>

> select distinct S from (
> select distinct SUM(SAL) from emp
> )
>

> is not the same as
>

> select distinct SUM(SAL) from (
> select distinct SAL from emp
> )
>

> where i'm using SQL with the "distinct" keyword merely as a surrogate for
> true relational syntax ("distinct" is redundant after aggregate operation,
> of course).

Why should the sum of all salaries equal the sum of distinct salaries? Received on Fri Feb 14 2003 - 00:47:32 CET

Original text of this message