my dog learned polymorphism
The moose likes Oracle/OAS and the fly likes i have a doubt on question Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Products » Oracle/OAS
Reply Bookmark "i have a doubt on question" Watch "i have a doubt on question" New topic
Author

i have a doubt on question

manas ranjan mandal
Ranch Hand

Joined: Apr 02, 2008
Posts: 97
In a village there are five families and each family has 2 children each as shown in the table structure
Parents:
Id,father,mother
Children:
Id,pid,age
Question: Give the output of each of the following queries
Select p.father,p.mother from parents p,children c where
c.pid=p.id and(c.age=(select MAX(age) from children)) or (c.age=(select
MIN (age) from children))

options are:

a)throws an SQL error
b)returns 0 rows
c)returns all the rows
d)returns atleast 2 rows

what will be the answer?
i am unable to understand the question.can any one tell me the answer?

Thanks in advance
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32712
    
    4
Three posts within an hour on Oracle! That's more than we usually have within a week.

Please use more informative titles for your threads.

What do you think (select min(age) from children) will do? Once you have worked that out, you can proceed with dissecting the question.
And make sure you have quoted the question exactly as given. Same as "post real code." I think you might have made a mistake copying it.
Hemavathy Ramamoorthy Gopal
Greenhorn

Joined: May 13, 2008
Posts: 17
Hi,

For example consider the children table has records where the minimum age is 10 and maximum age is 100

Output :

1) select MAX(age) from children ---- will result maximum value for eg: 100

2) select MIN(age) from children ---- will result maximum value for eg: 10

3) Select p.father,p.mother from parents p,children c where
c.pid=p.id and(c.age=(select MAX(age) from children)) or (c.age=(select
MIN (age) from children)) ---- will result all the records which has age column is equal to 10 or 100.



Regards,


Regards,
Hema_RG
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: i have a doubt on question
 
Similar Threads
Query to not duplicate join results (resolved)
SQL query doubt about counting based on a condition and selecting rows that comply.
jpql, join on?
ejbSelect method problem
How to make a JOIN without a directly mapped entity?