• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

questions related to sql queries

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi everyone
I'm new to sql and i'm finding kinda difficult
to do a problem please provide solution for
the following problem


There are 4 tables:
1>student table has fields like studentid,firstname,lastname,dateofbirth,emailid,schoolid(foreign key),adminid(foreign key)
2>admin has fields like adminid,ph_no,emailid
3>school has school board,school name,location,boad
4>test has testid,studentid,subject,marks

Questions:

Aggregating data :

1. Display the subject name and average marks scored for that subject in the descending order of the average marks scored.
2. Display the subjectname and average marks for all subjects whose average marks are greater than the average of all marks in the test table.
3. Display the schoolid and the number of students in that school


please let me know the sql queries in order to do the above task.....


thanks in advance

 
author & internet detective
Posts: 40747
827
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This looks like homework. We will help you figure it out, but not do the assignment for you. See NotACodeMill for more on this.

Starting with the first one.

Display the subject name and average marks scored for that subject in the descending order of the average marks scored.



Let's simplify this so we can see where you get stuck. Can you write any of these queries?
1) List all the subject name and individual scores for a given student
2) List all the subject names and average scores for a given student
3) Sort the results in the previous query

Post what you get up to and what puzzles you.
 
We've gotta get close enough to that helmet to pull the choke on it's engine and flood his mind! Or, we could just read this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic