Re: Newbie ex-Oracle person's question: Oracle ROWID = PSQL OID, Orac le ROWNUM = PSQL ???
От | Cliff Crawford |
---|---|
Тема | Re: Newbie ex-Oracle person's question: Oracle ROWID = PSQL OID, Orac le ROWNUM = PSQL ??? |
Дата | |
Msg-id | 20010511110110.B26098@cornell.edu обсуждение исходный текст |
Ответ на | Newbie ex-Oracle person's question: Oracle ROWID = PSQL OID, Orac le ROWNUM = PSQL ??? (Robert Beer <Robert.Beer@Callserve.com>) |
Список | 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
В списке pgsql-sql по дате отправления: