Controlling Reuslts with Limit

From: Najm Hashmi <najm(at)mondo-live(dot)com>
To: pgsql <pgsql-sql(at)postgresql(dot)org>
Subject: Controlling Reuslts with Limit
Date: 2001-02-24 21:09:06
Message-ID: 3A9822F2.FF9437C9@mondo-live.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,
I was reading through Bruce's on line . I found follwing bit unclear...

"Notice that each query uses ORDER BY . Although this clause is not required,
LIMIT without ORDER BY returns random rows from the query, which would be
useless. "

When I run a query several time I get the same results as given
flipr=# select song_id from songs limit 5;
song_id
---------
945
946
947
948
949
(5 rows)

flipr=# select song_id from songs limit 5;
song_id
---------
945
946
947
948
949
(5 rows)

flipr=# select song_id from songs limit 5;
song_id
---------
945
946
947
948
949
(5 rows)

flipr=# select song_id from songs limit 5;
song_id
---------
945
946
947
948
949
(5 rows)

flipr=# select song_id from songs limit 5;
song_id
---------
945
946
947
948
949
(5 rows)

flipr=# select song_id from songs limit 5;
song_id
---------
945
946
947
948
949
I just want to know what exatly --"LIMIT without ORDER BY returns random rows
from the query" --means
Regards

Attachment Content-Type Size
najm.vcf text/x-vcard 184 bytes

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2001-02-24 22:02:40 Re: greetings
Previous Message Ken Kline 2001-02-24 19:11:28 Re: greetings