Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: And the correct answer is?
Thank you Mr. Lewis.
Acutally both queries work and produce almost the same results. The word
results is where I believe my problem lies. The only difference is the
header with the use of the alias on one result.
SQL> select empno enumber, ename from emp order by 1;
ENUMBER ENAME
---------- ----------
7369 SMITH 7499 ALLEN 7521 WARD 7566 JONES 7654 MARTIN 7698 BLAKE 7782 CLARK 7788 SCOTT 7839 KING 7844 TURNER 7876 ADAMS
ENUMBER ENAME
---------- ----------
7900 JAMES 7902 FORD 7934 MILLER
14 rows selected.
SQL> select empno, ename from emp order by empno ASC;
EMPNO ENAME
---------- ----------
7369 SMITH 7499 ALLEN 7521 WARD 7566 JONES 7654 MARTIN 7698 BLAKE 7782 CLARK 7788 SCOTT 7839 KING 7844 TURNER 7876 ADAMS EMPNO ENAME ---------- ---------- 7900 JAMES 7902 FORD 7934 MILLER
14 rows selected.
Jonathan Lewis wrote:
> Would you check your typing.
>
> The second query ought to return error
> ORA-00936 - Missing expression
> as there is legal expression between the
> ORDER BY and the ASC.
>
> As it stands, B seems to be the correct answer.
>
> --
> Regards
>
> Jonathan Lewis
> http://www.jlcomp.demon.co.uk
>
> The educated person is not the person
> who can answer the questions, but the
> person who can question the answers -- T. Schick Jr
>
> One-day tutorials:
> http://www.jlcomp.demon.co.uk/tutorial.html
>
> ____UK_______April 8th
> ____UK_______April 22nd
> ____Denmark__May 21-23rd
> ____USA_(FL)_May 2nd
>
> Three-day seminar:
> see http://www.jlcomp.demon.co.uk/seminar.html
> ____UK_(Manchester)_May
> ____Estonia___June (provisional)
> ____USA_(CA, TX)_August
>
> The Co-operative Oracle Users' FAQ
> http://www.jlcomp.demon.co.uk/faq/ind_faq.html
>
> "sfk" <nospan_at_noway.org> wrote in message
> news:3E8E0B9E.B0B9251F_at_noway.org...
> > The following is from a text..... I would like some opinions ....
> what
> > is the correct answer.
> >
> > EMP Table is defined as follows:
> > EMPNO NUMBER 4
> > ENAME VARCHAR2 30
> > SALARY NUMBER 14,2
> > COMM NUMBER 10,2
> > DEPTNO NUMBER 2
> >
> > You perform the following tow queries:
> >
> > 1. SELECT empno enumber, ename FROM emp ORDER BY 1;
> > 2. SELECT empno, ename FROM emp ORDER BY ASC;
> >
> > Which of the following is true?
> > A. Statements 1 and 2 will produce the same result.
> > B. Statement 1 will execute; statement 2 will return an error.
> > C. Statement 2 will execute; statement 1 will return an error.
> > D. Statement 1 and 2 will execute but produce different results.
> >
> >
> >
Received on Sat Apr 05 2003 - 14:37:56 CST
![]() |
![]() |