Question, UNION

Ruslan Zasukhin sunshine at public.kherson.ua
Mon Jan 19 09:51:14 CST 2004


on 1/19/04 1:29 AM, Frank Schima at frank-list2 at mindstarprods.com wrote:

> 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.

Hi Frank,

Thank you for info.

I wonder, can you check on your side Sybase, Oracle, MS SQL,
Any other big db, to see self ?

I afraid you will find that they do provide order FIRST, SECOND.
I do not understand why?!

May be of course they use some strange algorithms, but algorithm which I
like is more fast. I am sure.


> 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
-------------------------------------------------------------



More information about the Valentina mailing list