• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

i have a doubt on question

 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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,
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic