Compare commits

...

2 commits

Author SHA1 Message Date
Imbus
d85132eb46 Makefile bumpå 2024-01-25 21:08:37 +01:00
Imbus
f5d7fa8df5 O fixed 2024-01-25 21:05:45 +01:00
2 changed files with 11 additions and 1 deletions

View file

@ -1,5 +1,5 @@
DB_NAME := lab.db
SQL_FILES := init.sql lab1.sql a.sql b.sql c.sql d.sql e.sql f.sql g.sql h.sql i.sql j.sql k.sql l.sql m.sql n.sql
SQL_FILES := init.sql lab1.sql a.sql b.sql c.sql d.sql e.sql f.sql g.sql h.sql i.sql j.sql k.sql l.sql m.sql n.sql o.sql
.PHONY: all clean

10
o.sql Normal file
View file

@ -0,0 +1,10 @@
DROP VIEW IF EXISTS StudentsCredits;
CREATE VIEW StudentsCredits AS
SELECT Students.pNbr, 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;