Re: [Help]How to translate from Algebra->SQL and viceverse?

From: Jan Hidders <hidders_at_REMOVE.THIS.win.tue.nl>
Date: 9 Nov 2000 13:28:11 GMT
Message-ID: <8ue8pb$5ao$1_at_news.tue.nl>


macefindu wrote:
>
> I was wondering why do we must learn Algebra if it cant handle all SQL's
> operators(ie: group by ... having ...). Just take a look at the demos
> *.sql that came with Oracle, most of them contain codes that easily
> exceed 20 select in one query!
> The only one reason that came out of my mind was "to exercise our brain
> muscles".

Well, that's one part of it :-), but it is also very relevant for query optimization. An algebra expression can be see as an abstract description of how you are going to compute the answer of the query: first we join T1 with T2, then we project the result and subtract it from T3, et cetera. Because the relational algebra is indeed an algebra we have some rewrite rules that allow us to rewrite such a description to an equivalent one that is more efficient. Afterwards you can then choose the appropriate algorithms that implement these operations, depending upon circumstances such as the sizes of the tables, the presence of some clustering, ordering, indices et cetera.

-- 
Kind regards,

    Jan Hidders
Received on Thu Nov 09 2000 - 14:28:11 CET

Original text of this message