Re: And the correct answer is?
Date: Thu, 3 Apr 2003 15:22:20 -0800
Message-ID: <Hs3ja.9$UE2.135_at_news.oracle.com>
"sfk" <nospan_at_noway.org> wrote in message
news:3E8E0B9E.B0B9251F_at_noway.org...
> SELECT empno, ename FROM emp ORDER BY 1;
I would object that interpreting 1 in the above query as column#1 is a good idea in the first place. Indeed, "order by" clause allows arbitrary expression wtich can involve any function upon columns, for example
SELECT empno, ename FROM emp ORDER BY lower(empno) || ename
"1" is just a constant function (or constant expression), so that
SELECT empno, ename FROM emp ORDER BY 1
must be equivalent to
SELECT empno, ename FROM emp ORDER BY 2
and to just
SELECT empno, ename FROM emp
If you are still not convinced, what in your opinion should
select * from emp order by 2 || 3
return? Received on Fri Apr 04 2003 - 01:22:20 CEST