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