Re: sql limitation?

From: Jim Kennedy <kennedy-family_at_home.com>
Date: Sun, 04 Nov 2001 03:34:55 GMT
Message-ID: <zH2F7.16032$Tb.8065997_at_news1.sttln1.wa.home.com>


Bob is correct. However, what Emmanuel might mean is I want the salesman with the 10th highest commission last month type of query. Jim

"Bob Hairgrove" <rhairgroveNoSpam_at_Pleasebigfoot.com> wrote in message news:3be4545e.40755012_at_news.webshuttle.ch...
> On 31 Oct 2001 05:01:45 -0800, Emmanuel.Fabre_at_tangensys.com (Fabre)
> wrote:
>
> >Hi,
> >
> >What is the efficient way to select the 10th row in a table?
> >Let's assume, there is no way to select it directly.
> >At the moment, I do not see how to avoid to select (and
> >fetch depending on the treatment) the first 9 rows.
> >Probably, it makes no sense from an sql point of view?
> >
> >Thanks in advance,
> >Emmanuel
>
> You're right ... it makes no sense from an SQL point of view. It only
> makes sense from a cursor's point of view, i.e. an SQL select
> statement which includes an ORDER BY clause.
>
> In any relational database, record order has no meaning at the table
> level. Consider a table as an unordered bucket of data. You retrieve
> the data by means of a unique identifier for a specific row, usually
> represented by a primary or candidate key which can be composed of one
> or more columns.
>
> Think about why you want the 10th row, and not the 9th or the 11th,
> and you will come up with some better criteria which will work in a
> relational way. You might first need to normalize your table design to
> make it work, though.
>
Received on Sun Nov 04 2001 - 04:34:55 CET

Original text of this message