Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: OCP Certification
Michael J. Moore wrote:
>>My favourite one:
>>Consider the following query:
>> SELECT Item_no FROM Item
>> WHERE Expiry_date = (SELECT Order_date FROM Order
>> WHERE Item_no = 2)
>>Which of the above is true?
>>A. The subguery will return the Order dates for item no 2 outer query.
>>B. The subquery will return an error
>>C. The outer query will return the item no for those items whose expiry
>>date is the same as the order date for item 2.
>>D. The outer query will return an error.
>>Authors said answers A and D are correct.
Actually, the question is correct. The error is that the Order table will contain more than one row with Item_no=2 therefore you cannot use the "=" operator - you have to use the "IN" operator.
BTW, it shouldnt be "Which of the above is true" - it should be "Which of the following is true". And the author is correct - option "A" and "D" are true. Received on Wed Dec 24 2003 - 19:36:12 CST