question

Shilkos avatar image
Shilkos asked

Average the students grade and show only that student on a different table?

Peace, Ok, so i have added the grades (For ex. Student_ID=3) of first_semester_Avg and second_semester_Avg and have the Total_average of those as well. My problem is that i don't know how to show that specific student (ID=3) with his average from all the subjects and show that on a different table. I mean i just want that one student with all his grades of Total_Avg added up and divided by how many grades there. And different classes have different number of subjects. Code I have tried: SELECT Grades.*, Students.First_Name, Students.Last_Name, Subjects.Subjects, Students.Student_ID, * FROM Subjects INNER JOIN (Students INNER JOIN Grades ON Students.Student_ID=Grades.Student_ID) ON Subjects.Subjects_ID=Grades.Subject_ID WHERE (((Students.Student_ID)=[Enter a Student ID])); I have written so many different codes and nothing works the way i want. Any help ?![alt text][1] Table Structure: ![alt text][2] [1]: /storage/temp/1244-totalavg.png [2]: /storage/temp/1248-1246-relationship.png
sqlaccess
totalavg.png (19.3 KiB)
5 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Shawn_Melton avatar image Shawn_Melton commented ·
Maybe show examples of what you have tried...
0 Likes 0 ·
Shawn_Melton avatar image Shawn_Melton commented ·
What DBMS are you using, can you provide table definition?
0 Likes 0 ·
Shilkos avatar image Shilkos commented ·
Added to original question
0 Likes 0 ·
relationship.png (27.8 KiB)
Shilkos avatar image Shilkos Shilkos commented ·
this is my code for joining the tables so that it SHOWS only one student. It works but i don't know how it can show AVERAGE OF ONLY ONE STUDENT and show all is other details
0 Likes 0 ·
Shilkos avatar image Shilkos Shilkos commented ·
SELECT Grades.*, Students.First_Name, Students.Last_Name, Subjects.Subjects, Students.Student_ID, * FROM Subjects INNER JOIN (Students INNER JOIN Grades ON Students.Student_ID=Grades.Student_ID) ON Subjects.Subjects_ID=Grades.Subject_ID WHERE (((Students.Student_ID)=[Enter a Student ID]));
0 Likes 0 ·

1 Answer

·
Shilkos avatar image
Shilkos answered
this pic is the design view of the code up:![alt text][1] [1]: /storage/temp/1247-joinq.png

joinq.png (23.6 KiB)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.