From 9a8bf9a324a71cb8224c273864036ecaf752bcdc Mon Sep 17 00:00:00 2001 From: Nathan Date: Thu, 29 Jul 2021 17:46:18 -0400 Subject: [PATCH] Finished lab --- .DS_Store | Bin 0 -> 6148 bytes answers/exercise1.sql | 4 ++++ answers/exercise2.sql | 4 ++++ answers/exercise3.sql | 4 ++++ answers/exercise4.sql | 3 +++ answers/exercise5.sql | 4 ++++ answers/exercise6.sql | 5 +++++ 7 files changed, 24 insertions(+) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..49c341a1b9c0a0480693843413a8dc22a4118b01 GIT binary patch literal 6148 zcmeHK%}&BV5S|5;1!Lr3BFA35aR4;_984O-gEx~JJ*a^;5NU!fp~XfK)7Q{9@(Fw$ zXLc7Nq6aU=keOumo1LHC?AK<006;WGof<$103<45rhv^iLUGas$rulzP-Apq2$7dW z1Fyf3&5r-b0DZeWxDY@D34Ho~p@)$-Z_xLnxLSP|nQU%lH7{jR7T1e6PA^QH*o{X~ z!yR5x@63&Rp0Urvus^e1@51jUtqQ(`-g&fEi#0mYe~z?a8$zUneh*8DIu}&j9TY7Am1_Fx9BG4s7W9 zNbwvY3EK3QAhZnH22+g~K@qwXQI`ty#1Oh1{g%nI4W=4(IS4f~j$>vP=7l2E?C7^t zItW`Mx6A-DFwa0%cT05spZxs(pD*GbGr$Zi6$2vIbeauZk~v!!7Ds2Th1y0Xp}bV% ltON~p6k{$O#bs0_=(or~v<;>j(SyPl0Yw8h%)p;A@BuiSQwsn9 literal 0 HcmV?d00001 diff --git a/answers/exercise1.sql b/answers/exercise1.sql index e69de29..93032d7 100644 --- a/answers/exercise1.sql +++ b/answers/exercise1.sql @@ -0,0 +1,4 @@ +SELECT * +FROM Enrolments +LEFT JOIN Students +ON Enrolments.StudentID=Students.StudentID; diff --git a/answers/exercise2.sql b/answers/exercise2.sql index e69de29..9dfb272 100644 --- a/answers/exercise2.sql +++ b/answers/exercise2.sql @@ -0,0 +1,4 @@ +SELECT * +FROM Enrolments +INNER JOIN Students +ON Enrolments.StudentID=Students.StudentID \ No newline at end of file diff --git a/answers/exercise3.sql b/answers/exercise3.sql index e69de29..19d13ac 100644 --- a/answers/exercise3.sql +++ b/answers/exercise3.sql @@ -0,0 +1,4 @@ +SELECT * +FROM Enrolments +RIGHT JOIN Students +ON Enrolments.StudentID=Students.StudentID; \ No newline at end of file diff --git a/answers/exercise4.sql b/answers/exercise4.sql index e69de29..366064a 100644 --- a/answers/exercise4.sql +++ b/answers/exercise4.sql @@ -0,0 +1,3 @@ +SELECT COUNT (StudentID) AS NumberOfStudents, Country +FROM Students +GROUP BY Country; \ No newline at end of file diff --git a/answers/exercise5.sql b/answers/exercise5.sql index e69de29..a7f9d95 100644 --- a/answers/exercise5.sql +++ b/answers/exercise5.sql @@ -0,0 +1,4 @@ +SELECT COUNT (StudentID) AS NumberOfStudents, Country +FROM Students +GROUP BY Country +ORDER BY COUNT (StudentID) DESC; \ No newline at end of file diff --git a/answers/exercise6.sql b/answers/exercise6.sql index e69de29..07bf7ef 100644 --- a/answers/exercise6.sql +++ b/answers/exercise6.sql @@ -0,0 +1,5 @@ +SELECT COUNT (StudentID) AS NumberOfStudents, Country +FROM Students +GROUP BY Country +HAVING COUNT (StudentID) > 10 +ORDER BY COUNT(StudentID) DESC; \ No newline at end of file