0
Select title, credits, courseid, avg(grade) as AVG_Grade 
From Course join Exam on course.courseid= exam.cid
group by title, credits, courseid
having avg(grade) = (select min(avg(grade)) from exam); 

This is my query to find the course with the worst GPA, I would like to do it with a nested query however this doesn't seem to work.

Chiara
  • 63
  • 6

1 Answers1

0

As the error message tells you you cannot select min(avg(grade)) from exam but you can select avg(grade) gd from exam order by gd limit 1

P.Salmon
  • 17,104
  • 2
  • 12
  • 19