Question, UNION

Frank Schima frank-list2 at mindstarprods.com
Sun Jan 18 18:29:35 CST 2004


Hi Ruslan,


My understanding is that you are right that the SQL standard does not 
say anything about UNION and record order in the result. I believe it 
is always implementation specific and users must use ORDER BY to 
guarantee a desired record order like any other SQL statement.


Best regards,
Frank

On Jan 18, 2004, at 1:16 PM, Ruslan Zasukhin wrote:

> 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
> -------------------------------------------------------------
>
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina
>



More information about the Valentina mailing list