pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedNewbie ex-Oracle person's question: Oracle ROWID = PSQL OID, Orac le ROWNUM = PSQL ???
3+ messages / 3 participants
[nested] [flat]
* Newbie ex-Oracle person's question: Oracle ROWID = PSQL OID, Orac le ROWNUM = PSQL ???
@ 2001-05-08 16:01 Robert Beer <Robert.Beer@Callserve.com>
0 siblings, 2 replies; 3+ messages in thread
From: Robert Beer @ 2001-05-08 16:01 UTC (permalink / raw)
To: pgsql-sql
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?
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!
Thanks in advance for any responses.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Newbie ex-Oracle person's question: Oracle ROWID = PSQL OID, Orac le ROWNUM = PSQL ???
@ 2001-05-11 15:01 Cliff Crawford <cjc26@cornell.edu>
parent: Robert Beer <Robert.Beer@Callserve.com>
1 sibling, 0 replies; 3+ messages in thread
From: Cliff Crawford @ 2001-05-11 15:01 UTC (permalink / raw)
To: Robert Beer <Robert.Beer@Callserve.com>; +Cc: pgsql-sql
* Robert Beer <Robert.Beer@Callserve.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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Newbie ex-Oracle person's question: Oracle ROWID = PSQL OID, Orac le ROWNUM = PSQL ???
@ 2001-05-11 15:29 J.H.M. Dassen (Ray) <jdassen@cistron.nl>
parent: Robert Beer <Robert.Beer@Callserve.com>
1 sibling, 0 replies; 3+ messages in thread
From: jdassen@cistron.nl @ 2001-05-11 15:29 UTC (permalink / raw)
To: pgsql-sql
Robert Beer <Robert.Beer@Callserve.com> wrote:
> Oracle has a ROWNUM pseudo column that works like this ...
> TEST>select callid, rownum from cs_calls where rownum < 5;
> Is there something like this in PSQL?
SELECT callid FROM cs_calls LIMIT 4;
HTH,
Ray
--
Give a man a fire, he's warm for a day. Set a man on fire, he's warm for
the rest of his life.
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2001-05-11 15:29 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-05-08 16:01 Newbie ex-Oracle person's question: Oracle ROWID = PSQL OID, Orac le ROWNUM = PSQL ??? Robert Beer <Robert.Beer@Callserve.com>
2001-05-11 15:01 ` Cliff Crawford <cjc26@cornell.edu>
2001-05-11 15:29 ` Re: Newbie ex-Oracle person's question: Oracle ROWID = PSQL OID, Orac le ROWNUM = PSQL ??? J.H.M. Dassen (Ray) <jdassen@cistron.nl>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox