12 lines
No EOL
433 B
SQL
12 lines
No EOL
433 B
SQL
--Same question as in question o) but with names instead of person numbers.
|
|
|
|
DROP VIEW IF EXISTS StudentsCredits;
|
|
|
|
CREATE VIEW StudentsCredits AS
|
|
SELECT Students.firstName, Students.lastName, sum(credits) as totalCredits
|
|
FROM Students
|
|
JOIN TakenCourses ON Students.pNbr = TakenCourses.pNbr
|
|
JOIN Courses ON TakenCourses.courseCode = Courses.courseCode
|
|
GROUP BY Students.pNbr;
|
|
|
|
SELECT * FROM StudentsCredits ORDER BY totalCredits DESC; |