Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQL multiple-choice question

apollon27May 29 2006 — edited May 30 2006
Below is a multiple choice question for preparing candidates for the exam
Introduction to Oracle SQL (1z0-007)

Evaluate this SELECT statement:

SELECT employee_id, name
FROM employee
WHERE employee_id NOT IN ( SELECT employee_id
FROM employee
WHERE department_id = 30
AND job = 'CLERK');

What would happen if the inner query returned NULL?

1) A syntax error would be returned
2) No rows would be selected from the EMPLOYEE table.
3) All the employee_id and name values in the EMPLOYEE table would be displayed
4) Only the rows with employee_id values equal to NULL would be included in the results.


I think the right answer is No 2, and not No 3 that the provider of this test says.
By the way the provider is SELF TEST SOFTWARE which is an authorized dealer by Oracle.

No 3 would be the right answer, if the inner query returned no rows at all, while the question says that the inner query returns NULL.


I made a test myself.

select e.employee_id, e.last_name
from employees e
where e.department_id not in ( select emp.department_id
from employees emp
where emp.employee_id = 178 )


if the inner query returns NULL, then the whole query will return no rows,
while if there is no employee with id 178 in the EMPLOYEES table ( the inner query returns no rows) the outer query will return all rows



What is your opinion?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 27 2006
Added on May 29 2006
5 comments
2,797 views