db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Boynes <jboy...@apache.org>
Subject Re: About improvement of DERBY-134
Date Mon, 14 Mar 2005 02:16:49 GMT
Satheesh Bandaram wrote:
> Not sure what you mean by *the case where you are using VALUES to construct a 
> table*,  Derby does allow naming those columns.
> 
> ij> values (1,1,1), (2,2,2);
> 1          |2          |3
> -----------------------------------
> 1          |1          |1
> 2          |2          |2
> ij> select * from (values (1,1,1), (2,2,2)) as t(i,j,k) order by i desc;
> I          |J          |K
> -----------------------------------
> 2          |2          |2
> 1          |1          |1
> 
> Aren't these symantically the same?
> 

As I read it they are close but a little different.

The first is simply constructing a table and as such the columns would 
have implementation dependent names; the second is constucting a table 
the same way (again with implementation dependent names) but as a table 
subquery with a derived column list that defines the column names for 
use in the outer select.

The second provides a portable (ok, conforming) way of naming the 
columns. To do the same thing the first way we would need to support

values (1,1,1), (2,2,2) order by "SQLCol1" desc

in the same way as

ij> select "SQLCol3" from ( values(1,2,3),(4,5,6)) as t order by 
"SQLCol3" desc;
SQLCol3
-----------
6
3

works now.
--
Jeremy

Mime
View raw message