• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

questions related to sql queries

 
RabiDas Sharma
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • 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

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35269
383
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic