Re: Is relational theory irrelevant? (was Re: Dreaming About Redesigning SQL)

From: Lauri Pietarinen <lauri.pietarinen_at_atbusiness.com>
Date: Tue, 11 Nov 2003 11:00:28 +0200
Message-ID: <3FB0A52C.2050105_at_atbusiness.com>


Mikito Harakiri wrote:

>"Bob Badour" <bbadour_at_golden.net> wrote in message
>news:sZqdnURpMcikvzKi4p2dnA_at_golden.net...
>
>
>>"Mikito Harakiri" <mikharakiri_at_yahoo.com> wrote in message
>>news:bdf69bdf.0311092059.7fa5b13f_at_posting.google.com...
>>
>>
>>>"Bob Badour" <bbadour_at_golden.net> wrote in message
>>>
>>>
>>>>Express a quota query.
>>>>
>>>>
>>>select top 5 * from (
>>> select * from emp order by sal
>>>)
>>>
>>>What is the problem, besides "5*from" looking ugly?
>>>
>>>
>>The ordered operand.
>>
>>
>
>OK. Then
>
>select EX.EMP#
>from EMP EX
>where (select count(1)
> from EMP EY
> where EY.HEIGHT < EX.HEIGHT) < 5
>
>
>
Wow! That is BEAUTIFUL! And I bet it will be easy to teach an optimiser how to handle it best ;-)

BTW, what if you had to order on more than one column (as is often the case)?

regards,
Lauri Received on Tue Nov 11 2003 - 10:00:28 CET

Original text of this message