Re: How to select specific rows in ANSI SQL ?

From: Roy Brokvam <roy.brokvam_at_conax.com>
Date: Fri, 5 Jan 2001 19:20:57 +0100
Message-ID: <ggo56.10124$v46.328338_at_news1.oke.nextra.no>


bdimple_at_my-deja.com wrote in message <92e0uh$6rp$1_at_nnrp1.deja.com>...
>Is it possible to code the equivalent of MySQL Specific LIMIT
>using ANSI SQL?
>
>For example, select * from where... LIMIT n1, n2?
>gives you the records starting from the n1-th result row and n2 results?
>
>I have tried joining the table to itself but I can't get it to work.
>
>I'd be very grateful for any and all suggestions.
>
>TIA
>
>B.Dimple
>

Hi,

Since this is a theory group, I'd first like to point out that in relational theory there is no implicit ordering of tuples (records). A relation (table) contains a *set* of tuples, and that's it.

In practice, you order the records as they are selected for output. If you use Oracle, you may use the RANK() operator and limit your query based on the rank. I don't know if ANSI SQL provides this operator.

--
Roy Brokvam
Received on Fri Jan 05 2001 - 19:20:57 CET

Original text of this message