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 -> 2 SQL test questions

2 SQL test questions

From: <girlgeek_at_wt.net>
Date: Tue, 14 Nov 2000 13:37:52 -0800
Message-ID: <3A11B0B0.B3468035@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:

  1. will supply only requested info
  2. will not supply requested info
  3. needs a function in the select clause
  4. 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?

  1. all employees have a manager
  2. no employees have a manager
  3. a null is returned from the subquery
  4. not in is not allowed in a subquery

Any ideas?

Thanks,
Claudia Received on Tue Nov 14 2000 - 15:37:52 CST

Original text of this message

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