Re: Best method to SELECT TOP n TO m of a table

From: Lennart Jonsson <lennart_at_kommunicera.umea.se>
Date: 5 Nov 2003 12:22:43 -0800
Message-ID: <6dae7e65.0311051222.51447a06_at_posting.google.com>


Troels Arvin <troels_at_arvin.dk> wrote in message news:<pan.2003.11.04.19.24.04.92089_at_arvin.dk>...
> On Tue, 04 Nov 2003 14:15:04 +0000, Will Clark wrote:
>
> > I was wondering if there was a better way to do a SELECT where it returns
> > not the TOP 5 (or whatever) but, say, the TOP 6 to 8?
>
> I have written about the subject here:
> http://troels.arvin.dk/db/rdbms/#select-limit-offset

Very nice page. A few comments

In the localtimestamp DB2 section you say that:

>CURRENT_TIMESTAMP (alias to 'CURRENT TIMESTAMP') which may be used as
though it >were a function without arguments. However, since DB2 doesn't provide time zone >support, the availability of CURRENT_TIMESTAMP could be said to be against the >standard—at least confusing.

There is a special register for CURRENT TIMEZONE as well. I.e. you can do

db2 values current timestamp - current timezone

In the get list of tables DB2

You can also get the tables by:

select * from syscat.tables

In the "Getting a table description" DB2

Also:

 SELECT c.colname, c.tabname, c.typename, c.length, c.default, c.nulls  FROM
  syscat.columns as c,
WHERE
  c.tabname='TABLENAME

Kind regards
/Lennart Received on Wed Nov 05 2003 - 21:22:43 CET

Original text of this message