Обсуждение: sorted result

Поиск
Список
Период
Сортировка

sorted result

От
"Al-Haddad, Mohammad J"
Дата:
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
 
 
thank you
 
 
 

Re: sorted result

От
Einar Karttunen
Дата:
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