Fixed n
This commit is contained in:
parent
3dd7d1c576
commit
228ff2efe2
1 changed files with 9 additions and 7 deletions
16
n.sql
16
n.sql
|
@ -1,7 +1,9 @@
|
||||||
select Students.firstName, max(averageGrade) as maxAverage
|
DROP VIEW IF EXISTS StudentsAverages;
|
||||||
from (
|
|
||||||
select Students.pNbr, TakenCourses.grade, avg(grade) as averageGrade
|
CREATE VIEW StudentsAverages AS
|
||||||
from Students
|
SELECT Students.firstName, Students.pNbr, TakenCourses.grade, avg(grade) as averageGrade
|
||||||
join TakenCourses on Students.pNbr = TakenCourses.pNbr
|
FROM Students
|
||||||
group by Students.pNbr
|
JOIN TakenCourses ON Students.pNbr = TakenCourses.pNbr
|
||||||
) as studentAverages
|
GROUP BY Students.pNbr;
|
||||||
|
|
||||||
|
SELECT firstName, max(averageGrade) FROM StudentsAverages
|
Loading…
Reference in a new issue