diff --git a/answers/exercise1.sql b/answers/exercise1.sql index e69de29..04736df 100644 --- a/answers/exercise1.sql +++ b/answers/exercise1.sql @@ -0,0 +1,4 @@ +SELECT * +FROM Enrolments +LEFT JOIN Students +ON Enrolments.StudentID = Students.STUDENID; \ No newline at end of file diff --git a/answers/exercise2.sql b/answers/exercise2.sql index e69de29..34d54ac 100644 --- a/answers/exercise2.sql +++ b/answers/exercise2.sql @@ -0,0 +1,4 @@ +SELECT * +FROM Enrolments +INNER JOIN Students +ON Enrolments.StudentID=Students.StudentID; diff --git a/answers/exercise3.sql b/answers/exercise3.sql index e69de29..b77772c 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..247d511 100644 --- a/answers/exercise4.sql +++ b/answers/exercise4.sql @@ -0,0 +1,3 @@ +SELECT COUNT(STUDENTS),Country +FROM Learners +GROUP BY Country; \ No newline at end of file diff --git a/answers/exercise5.sql b/answers/exercise5.sql index e69de29..2b2adf7 100644 --- a/answers/exercise5.sql +++ b/answers/exercise5.sql @@ -0,0 +1,4 @@ +SELECT COUNT(STUDENTS), Country +FROM Learners +GROUP BY Country +ORDER BY COUNT(STUDENTS) DESC; \ No newline at end of file diff --git a/answers/exercise6.sql b/answers/exercise6.sql index e69de29..69157ad 100644 --- a/answers/exercise6.sql +++ b/answers/exercise6.sql @@ -0,0 +1,5 @@ +SELECT COUNT(STUDENTS), Country +FROM Learners +GROUP BY Country +HAVING COUNT(STUDENTS) > 10 +ORDER BY COUNT(Country) DESC; \ No newline at end of file