Re: Extending my question. Was: The relational model and relationalalgebra - why did SQL become the industry standard?

From: Lauri Pietarinen <lauri.pietarinen_at_atbusiness.com>
Date: Fri, 21 Feb 2003 09:41:55 +0200
Message-ID: <3E55D843.8000007_at_atbusiness.com>


>
>
>What happens here if the 10th and 11th ranking of employees by salary have the
>same salary? Should you not get a compile error if salary is not unique
>within emp?
>
In that case both 10th and 11th will be included, as stated in TTM. In practice, if you want _exactly_ 10 values (provided there are at least 10 employees) you could include the key in the ranking, e.g.

  SELECT emp OVER{salary,empno} WHERE deptno=1 RETURN 10 BY {salary desc, empno}

>I'm rather partial to DB2's
> RANK() OVER ()
>and
> RANK_DENSE() OVER()
>
>for quota queries.
>
>

That's interesting.... How would that previous query look like in DB2?

regards,
Lauri Pietarinen Received on Fri Feb 21 2003 - 08:41:55 CET

Original text of this message