Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Extending my question. Was: The relational model and relational algebra - why did SQL become the industry standard?
"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). Received on Thu Feb 13 2003 - 14:37:11 CST