select Students.firstName, max(averageGrade) as maxAverage
from (
        select Students.pNbr, TakenCourses.grade, avg(grade) as averageGrade
        from Students
        join TakenCourses on Students.pNbr = TakenCourses.pNbr
        group by Students.pNbr
) as studentAverages