Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: And the correct answer is?

Re: And the correct answer is?

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Sat, 5 Apr 2003 22:01:55 +0100
Message-ID: <b6ng6t$4qe$1$830fa79d@news.demon.co.uk>

If you check your original posting, you will notice that you have omitted the 'empno' from the ORDER BY clause in the second statement.

> > 2. SELECT empno, ename FROM emp ORDER BY ASC;

When the 'empno' is replaced, the two resulting data sets will be the same - but, as you rightly point out, the two results are different because the headings are different.

Yet another silly example of a badly posed, or at least ambiguous, question - I am not surprised that one of your other posts tells us that this is an OCP related question.

--
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


"oracleuser" <nospan_at_noway_nohow.org> wrote in message
news:3E8F3E26.7BAAD5A4_at_noway_nohow.org...

> 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.
> >
Received on Sat Apr 05 2003 - 15:01:55 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US