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

Date: 11 Mar 2003 22:40:51 +0100

Message-ID: <3e6e57e3.0_at_news.ruca.ua.ac.be>

Mikito Harakiri wrote:

>"Jan Hidders" <jan.hidders_at_REMOVE.THIS.ua.ac.be> wrote in message

*>news:3e6e4547.0_at_news.ruca.ua.ac.be...
**>>
**>> Such as combining two iterations over the same bag into one. It's pretty
**>> easy to see that
**>>
**>> SELECT f(x)
**>> FROM x IN
**>> SELECT g(y)
**>> FROM y IN Y
**>>
**>> is the same as
**>>
**>> SELECT f(g(y))
**>> FROM y in Y
**>>
**>> which is a simple straightforward rule in bag algebra.
**>
**>Let XY be
**>
**>x y
**>- -
**>1 1
**>1 2
**>2 3
**>
**>Then,
**>
**>select x from XY
**>where x in (select y from XY)
**>
**>returns 1 and 2
**>
**>while
**>
**>select y from XY
**>
**>returns
**>
**>1,1, and 2
**>
**>Or my SQL interpretation of your formulas is wrong?
*

No, I messed the notation a bit up because I thought it would be more clear. What I meant was:

*>> SELECT f(x)
**>> FROM
**>> ( SELECT g(y)
**>> FROM y IN Y ) AS x
*

and

*>> SELECT f(g(y))
**>> FROM Y AS y
*

- Jan Hidders