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

Home -> Community -> Usenet -> c.d.o.tools -> Re: 2 SQL test questions

Re: 2 SQL test questions

From: whoever <fred_at_nowhere.net>
Date: Wed, 15 Nov 2000 07:45:30 -0600
Message-ID: <8uu41t$hdb$0@pita.alt.net>

In 1) if either is NULL, the answer should also be NULL (you need both numbers
to determine an answer). So, if you are using a NVL function, you would be generating a wrong answer. It doesn't make sense to presume zero (or whatever).

girlgeek_at_wt.net wrote in message <3A11B0B0.B3468035_at_wt.net>...
>I just returned from taking the SQL & PL/SQL exam. (Passed - Whew!)
>
>Two questions puzzle me. Maybe someone else has an idea of the correct
>answers:
>
>1.Create a report that will show net profit per product if the cost is
>increased 10% and the sale price is increased 25%. The product table
>follows
>
>Products table
>Id number(3) pk
>Sale number (8,2)
>Cost number (8,2)
>
>Given the query:
>
>Select id, sale * 1.25 - cost * 1.1 net
>From products;
>
>Which happens:
>
>a. will supply only requested info
>b. will not supply requested info
>c. needs a function in the select clause
>d. The order of the operations needs to be reversed
>
>I was stuck between a & c. The query should work, but it would be
>better with a NVL function in case some
>rows have a null for cost or sale. What is your take?
>
>
>
>2. Mr King is President of the company. Four managers report to him and
>all other employees report to these four managers.
>
>The query:
>
>select e.name
>from emp e
>where e.id not in
> (select m.mgr
> from emp m);
>
>returns 'no rows selected' Why?
>
>a. all employees have a manager
>b. no employees have a manager
>c. a null is returned from the subquery
>d. not in is not allowed in a subquery
>
>Any ideas?
>
>Thanks,
>Claudia
Received on Wed Nov 15 2000 - 07:45:30 CST

Original text of this message

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