DROP VIEW IF EXISTS StudentsAverages;

CREATE VIEW StudentsAverages AS
SELECT Students.firstName, Students.pNbr, TakenCourses.grade, avg(grade) as averageGrade
FROM Students
JOIN TakenCourses ON Students.pNbr = TakenCourses.pNbr
GROUP BY Students.pNbr;

SELECT firstName, max(averageGrade) FROM StudentsAverages