Question, UNION

Ruslan Zasukhin sunshine at public.kherson.ua
Sun Jan 18 20:16:48 CST 2004


Hi guys,

We here have small discussion (between Valentina developers)
And I want ask, may be somebody have prompt us.

Let we have 

    SELECT ...
        UNION
    SELECT ...    
     

My opinion is that SQL do not guarantee ORDER OF RECORDS in the result,
Until you specify ORDER BY.


Ivan, says that Sybase, Oracle and MS SQL, all return result in order
    at first records of FIRST SELECT, then records of SECOND.

We have check, and it seems to be true. They return result in this way.

The funny is, that we can produce result by MY way, more faster, than if we
will try save order of records.


I do not see any reason why UNION must work in the way as it works in
Sybase, and others....

We have not found any words about this in the standard...
may be we are blind?


So does anybody have any additional info about this?


---------
BTW, Ivan,

I think that in the case we have

    SELECT ...
        UNION
    SELECT ...    
    ORDER BY

We can use the first way and algorithm, because for such query
It is exactly not needed to make special order for UNION,
It will be changed by ORDER BY later.

So in the worse case, we can have 2 algorithms.
The first will eat less RAM.

What you think?


-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list