From: | Cliff Crawford <cjc26(at)cornell(dot)edu> |
---|---|
To: | Robert Beer <Robert(dot)Beer(at)Callserve(dot)com> |
Cc: | "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Newbie ex-Oracle person's question: Oracle ROWID = PSQL OID, Orac le ROWNUM = PSQL ??? |
Date: | 2001-05-11 15:01:10 |
Message-ID: | 20010511110110.B26098@cornell.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
* Robert Beer <Robert(dot)Beer(at)Callserve(dot)com> menulis:
> Oracle has a ROWNUM pseudo column that works like this ...
> TEST>select callid, rownum from cs_calls where rownum < 5;
>
> CALLID ROWNUM
> ---------- ----------
> 7806 1
> 7807 2
> 7809 3
> 6443 4
>
> 4 rows selected.
>
> ... which can be quite handy.
>
> Is there something like this in PSQL?
You can use the LIMIT clause:
SELECT callid FROM cs_calls LIMIT 4;
See
<http://postgresql.readysetnet.com/users-lounge/docs/7.1/postgres/sql-select.html>
for more info.
> By the way, having used Oracle since 1987 it's a pleasure to use PSQL.
> Someone actually thinks about the implemented features.
> For example, Oracle's implementation of ROWNUM gives them in the order the
> rows were BEFORE the ORDER BY, which is not of much use as adding an ORDER
> BY jumbles them up. Duh!
LIMIT in PostgreSQL applies *after* ORDER BY, so you won't have this
problem :)
--
Cliff Crawford http://www.sowrong.org/
birthday party cheesecake jellybean BOOM
From | Date | Subject | |
---|---|---|---|
Next Message | Roberto Mello | 2001-05-11 15:06:05 | Re: [HACKERS] Problems in porting from Oracle to Postgres |
Previous Message | Jeff Eckermann | 2001-05-11 14:35:39 | RE: Order by email address by domain ? |