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
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.....
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