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: Mikito Harakiri <mikharakiri_at_ywho.com>
Date: Fri, 4 Apr 2003 10:53:04 -0800
Message-ID: <fCkja.6$1%6.65@news.oracle.com>


"sfk" <nospan_at_noway.org> wrote in message news:3E8DCB8E.75AD1103_at_noway.org...
> The author states A as the correct answer. I choose D.
>
>
> > > 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.

OCP questions where DBA have to guess the output produced by SQL engine -- like in the question submited by autor -- are really irritating. Whom DBA is supposed to be -- a monkey that memorized all the SQL quirks, no matter whether they make sence or not? Isn't he allowed to just run the SQL and analyse the output? Well, the later requires some critical thinking, and that what the current industry environmnent lacks for.

Returning to the question, it depends whether we want to interpret

SELECT empno, ename FROM emp ORDER BY ASC

as

SELECT empno, ename FROM emp ORDER BY NULL ASC

or just as a syntax error. It indeed produced error in my 9.2 env.

Nitpicking, queries 1 and 2 _can't_ produce the same result: the first one involves renaming, the second one doesn't. If 2 queries have different signature, they are producing different result set, even though the context might be literally the same. Received on Fri Apr 04 2003 - 12:53:04 CST

Original text of this message

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