Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: And the correct answer is?
"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 Thu Apr 03 2003 - 17:22:20 CST
![]() |
![]() |