From 86bcc8efc2b3c0704968247f2f490ca4f067905d Mon Sep 17 00:00:00 2001 From: laura Date: Sun, 1 Aug 2021 17:48:07 -0400 Subject: [PATCH 1/2] done --- .DS_Store | Bin 0 -> 6148 bytes .idea/.gitignore | 3 +++ .idea/SQL.LetsGetTogether.iml | 9 +++++++++ .idea/misc.xml | 6 ++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ answers/exercise1.sql | 3 +++ answers/exercise2.sql | 4 ++++ answers/exercise3.sql | 4 ++++ answers/exercise4.sql | 1 + answers/exercise5.sql | 1 + answers/exercise6.sql | 1 + 12 files changed, 46 insertions(+) create mode 100644 .DS_Store create mode 100644 .idea/.gitignore create mode 100644 .idea/SQL.LetsGetTogether.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..0f642995a75ccd2058aed4e55b0146695e4ba0ae GIT binary patch literal 6148 zcmeHK%}yIJ5FUpB-c%JiR4Uwj=`BJ@gFrbTZPRezfP}iJJ+ugRyAiCktWkE;RhtIw zbHGFJ9=t#wr_9(Uf~LKqsG5<+-`F$bU4ORx0|25wjynKN0FbDJH4lrw2>D6pq~==c zh{E(Sgc0QXss0+JbJ5(ehz!u&twIPH9D+rzDGY+1KMN&P_jobx7$+@1(ggnRI%+t(NL`ccv{h>Ah{Y)K+(U zI`!o1H=W)6(~IvvCO@ZF*JdOjaMc=FbNB!^X#By-w_uc|Iy*xTWqI%c_K=$a93XDO z1;lpU&v?7VsK>lvm4z8#2AF{bVZiNv^2LJu5B~-;zzi%71GGOVR6^fjWzlRMSePdO zB3&bmpiP%X%25t|hm}S2pa`3aXj6rIVhEd#?aIaZ4l9c`9fW&)2=`^-UMRwR9s5@% z9E5L?OJ;x>c*?+%tv2cW-~0Fb|7jA}m;q+szhXet2f?6^Lvm;9+~DY}Rj8+^BotR! moTZ>)j$(|Zqj(+F2(~LS5PgT0MQlOgi-4hl3ufS18Mp^10Bnl@ literal 0 HcmV?d00001 diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/SQL.LetsGetTogether.iml b/.idea/SQL.LetsGetTogether.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/SQL.LetsGetTogether.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..639900d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..a731dc1 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/answers/exercise1.sql b/answers/exercise1.sql index e69de29..b835076 100644 --- a/answers/exercise1.sql +++ b/answers/exercise1.sql @@ -0,0 +1,3 @@ +SELECT * FROM Enrolments e +LEFT JOIN Students s +ON s.Students = e.StudentID; \ No newline at end of file diff --git a/answers/exercise2.sql b/answers/exercise2.sql index e69de29..0507fc0 100644 --- a/answers/exercise2.sql +++ b/answers/exercise2.sql @@ -0,0 +1,4 @@ +SELECT * +FROM Enrolments e +INNER JOIN Students s +ON Enrolments.StudentID=Students.StudentID; \ No newline at end of file diff --git a/answers/exercise3.sql b/answers/exercise3.sql index e69de29..1d40efc 100644 --- a/answers/exercise3.sql +++ b/answers/exercise3.sql @@ -0,0 +1,4 @@ +SELECT * +FROM Enrolments +LEFT 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..8fb9994 100644 --- a/answers/exercise4.sql +++ b/answers/exercise4.sql @@ -0,0 +1 @@ +SELECT COUNT(Country) FROM Students GROUP BY Country; diff --git a/answers/exercise5.sql b/answers/exercise5.sql index e69de29..14fea69 100644 --- a/answers/exercise5.sql +++ b/answers/exercise5.sql @@ -0,0 +1 @@ +SELECT COUNT(Country) FROM Students GROUP BY Country ORDER BY COUNT(Country) DESC; \ No newline at end of file diff --git a/answers/exercise6.sql b/answers/exercise6.sql index e69de29..86ca4a3 100644 --- a/answers/exercise6.sql +++ b/answers/exercise6.sql @@ -0,0 +1 @@ +SELECT COUNT(Country) FROM Students GROUP BY Country HAVING COUNT(Country) > 10 ORDER BY COUNT(Country) DESC; \ No newline at end of file From 7a877b2aa28762ae243b190bec8c74091f89a994 Mon Sep 17 00:00:00 2001 From: laura Date: Wed, 13 Oct 2021 15:24:00 -0400 Subject: [PATCH 2/2] sql --- .DS_Store | Bin 6148 -> 6148 bytes README.md | 57 ------------------------------------------------------ 2 files changed, 57 deletions(-) delete mode 100644 README.md diff --git a/.DS_Store b/.DS_Store index 0f642995a75ccd2058aed4e55b0146695e4ba0ae..5ea25734e71d94e2435db217545af44c479e5758 100644 GIT binary patch delta 38 ucmZoMXfc@J&&a$nU^gQp^JE^TYfPqwlbvA##F}N}~GPp4K0%<*lT!s|Soc!dZ doctsP1_l8jUJt~2|G{9hBlC2Y&Fmb1`2l%W7#aWo diff --git a/README.md b/README.md deleted file mode 100644 index 87c8362..0000000 --- a/README.md +++ /dev/null @@ -1,57 +0,0 @@ -# SQL: Let's Get Together - -Given the scenarios, add the the directed queries to the "answers" directory's files. - - -## Introduction to Joins - -Insert the missing parts in the **JOIN** clause to join the two tables **Enrolments** and **Students**, using the **StudentID** field in both tables as the relationship between the two tables. - -``` -SELECT * -FROM Enrolments -LEFT JOIN Students -[insert clause here]; -``` -*(Add your query to the file exercise1.sql)* - -Choose the correct **JOIN** clause to select all records from the two tables where there is a match in both tables. - -``` -SELECT * -FROM Enrolments -[insert clause here] -ON Enrolments.StudentID=Students.StudentID; -``` - -*(Add your query to the file exercise2.sql)* - - -Choose the correct **JOIN** clause to select all the records from the **Students** table plus all the matches in the **Enrolments** table. - - -``` -SELECT * -FROM Enrolments -[insert clause here] -ON Enrolments.StudentID=Students.StudentID; -``` - -*(Add your query to the file exercise3.sql)* - -## Grouping records by Column -List the number of **Students** in each **Country**. - - -*(Add your query to the file exercise4.sql)* - -List the number of **Students** in each **Country**, ordered by the **Country** with the most **Students** first. - - -*(Add your query to the file exercise5.sql)* - - - -List the number of **Students** in each **Country**, ordered by the **Country** with the most **Students** first, where the number of students is greater than 10. - -*(Add your query to the file exercise6.sql)*