For each Computer Sciences class, print the cno, sectno, and the average gpa of
ID: 3651654 • Letter: F
Question
For each Computer Sciences class, print the cno, sectno, and the average gpa of the students enrolled in the class.I tried...
SELECT cno, sectno, gpa, dname
FROM Enroll, Student
Where dname = 'Computer Sciences' and GPA = (SELECT AVG(gpa) FROM Student)
However it gives me no results. Just the column name.
I would appreciate anyone being able to show me how to find the average gpa of the students enrolled in the Computer Sciences class.
Here are the Tables...
Student(sid,sname,sex,age,year,qpa)
Dept(dname,numphds)
Prof (pname,dname)
Course (cno,cname,dname)
Major(dname,sid)
Section(dname,cno,sectno,pname)
Enroll(sid,grade,dname,cno,sectno)
Explanation / Answer
You will get average of all dnames, including Computer Science SELECT avg(s.gpa), e.dname FROM Enroll e, Student s Where e.sid = s.sid group by e.dname
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.