Re: Extending my question. Was: The relational model and relationalalgebra - why did SQL become the industry standard?
Date: Mon, 24 Feb 2003 22:01:55 +0200
Message-ID: <3E5A7A33.1000808_at_atbusiness.com>
>
>
>I assumed so.
>I must say that I'm disappointed that Dataphor uses RETURN as a keyword here.
>
Maybe so...
The Third Manifesto covers the issue in RM Very Strong Suggestion 5. It ends up introducing a relational operator called 'QUOTA'.
>> SELECT emp OVER{salary,empno} WHERE deptno=1 RETURN 10 BY {salary
>>desc, empno}
>>
>>
>
>the uninitiated would expect the above to RETURN (at most) 10 ROWs.
>Something such as
>
>SELECT emp OVER{salary,empno} WHERE deptno=1
>AND RANK{salary desc, empno} <= 10
>
>would look better to me
>
I think it is better to have an honest relational operator, as in
Dataphor.
>>That's interesting.... How would that previous query look like
>>in DB2?
>>
>
>SELECT *
>FROM (
> SELECT EMPNO, SALARY
> , rank() over(order by SALARY desc) as rank
> , dense_rank() over(order by SALARY desc) as dense_rank
> , row_number() over(order by SALARY desc, EMPNO) as rn
> FROM employee) as s
>WHERE RANK <= 10"
>
OK, thanks! A bit cumbersome, but it does the job.
In what DB2-version was this introduced?
regards,
Lauri Pietarinen
Received on Mon Feb 24 2003 - 21:01:55 CET