From: | Einar Karttunen <ekarttun(at)cs(dot)Helsinki(dot)FI> |
---|---|
To: | "Al-Haddad, Mohammad J" <mjalha(at)essex(dot)ac(dot)uk> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: sorted result |
Date: | 2001-10-25 11:19:30 |
Message-ID: | 20011025141930.A24210@cs.helsinki.fi |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
On Thu, Oct 25, 2001 at 11:58:39AM +0100, Al-Haddad, Mohammad J wrote:
> hi there,
> if I have a table T1 with primary key P. and attributes A1,A2 and A3
> and I have this query:
> select * form T1 where the P = 123;
>
> do I get the intermediate relation result sorted based on the primary
> key?
>
> what about if the query somthing like this:
> select A1 from T1 where A2 = 456
>
> do I get the intermediate result sorted by the primary key
>
No, all results are returned in a pseudo-random order.
If you wish that the resultset is sorted use the ORDER BY-clause.
SELECT * FROM T1 WHERE A2=456;
pseudo-random order.
SELECT * FROM T1 WHERE A2=456 ORDER BY P;
sorted.
- Einar Karttunen
From | Date | Subject | |
---|---|---|---|
Next Message | Joshua b. Jore | 2001-10-25 12:11:39 | undo delete w/ transaction? |
Previous Message | Al-Haddad, Mohammad J | 2001-10-25 10:58:39 | sorted result |