Re: What is the ansi standard in this case
Posted in 1993
>From: uunet!HP-UX!mharis (Mohnish Harisinganey)
>Subject: What is the ansi standard in this case
>Date: 21 May 93 00:32:40 GMT
>X-Informix-List-Id: <news.3392>
>
>Informix (isql) doensn't allow the following query with a
>message saying order by column d should be in the select list.
>
>select a,b,c,
>order by d;>
>whereas Rdb/VMS executes it .
>
>I am interested to know what is the ansi rule (if any) and the way other
>RDBMS behave.
I can't quote the section of the standard at you, but the SQL92 standard
doesn't allow any more than Informix does.
On page 114 of Date's "A Guide to the SQL Standard, 3rd Edition", it says:
Note that ... each order-item must identify a column of the result
table. Thus, for example, the following is *** ILLEGAL ***:
DECLARE Z CURSOR
FOR SELECT S.SNO
FOM S
ORDER BY CITY -- This is *** ILLEGAL *** !!!
It would be fair to say it is a common extension to allow it, but it is not
ANSI standard.
Jonathan Leffler (johnl@obelix.informix.com) #include <disclaimer.h>