SQL Query help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JCowing
    New Member
    • Mar 2008
    • 1

    SQL Query help

    Hi,

    Im new at SQL, can anyone help with the following questions?

    Finsbury Zoo keeps data about the care of theirs animals in a relational database with the following schema:
    Animal (ID {pk}, Name, Species, Age, Sex, Weight, F-ID, M-ID)
    Keeper (Staff-id {pk}, Keeper-Name, Specialisation)
    Care-Role (ID {pk}, Staff-id {pk}, Role)
    Primary key attributes are indicated with {pk}.

    Notes – All attributes are ‘Char’, except for Age & Weight that are numeric. F-ID is the ID of the animal’s father and M-ID is the ID of the animal’s mother.

    Specify the following queries in SQL:

    i) List the names and IDs of all Lions more than 5 years old.

    ii) List the names of all Keepers whose roles include ‘feeding’ Giraffes.

    iii) What is the average weight of the adolescent female elephants. N.b. An adolescent elephant is between the ages of 6 and 10 years inclusive.

    Kind Regards

    J.Cowing
  • mwasif
    Recognized Expert Contributor
    • Jul 2006
    • 802

    #2
    Hi JCowing,

    Welcome to TSDN!!!

    What you have tried so far?

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      Welcome to The Scripts!

      The wording of this sounds exactly like a school homework assignment.

      You'll have to study some (My)SQL first, then write some queries and, having problems with that, come here for help. Unless you already have some queries made (in that case I apologise), then show them and we will help you getting along.

      But we do not deliver made-to-measure SQL statements here.

      Ronald

      Comment

      • Gox
        New Member
        • Mar 2008
        • 1

        #4
        It is a blatant coursework question..

        I have done those questions but struggle with working out how to get "grandchild ren" of a specific animal (Horace) having been given only F-ID and M-ID being father and mother IDs respectively.

        The full question is:

        List the names of all the grandchildren of 'Horace', a male 'Marmoset'

        While I can sort animals by Species and further pick out all Horace's children, how do I work out his grandchildren? Double nest?

        Please help

        Thank you

        Gox

        Comment

        Working...