From 3a01cfd910b06267238e8f0ee6d0761a712574bd Mon Sep 17 00:00:00 2001 From: David Trombello Date: Tue, 10 Dec 2019 22:01:17 -0500 Subject: [PATCH 1/2] queries added --- .idea/$PRODUCT_WORKSPACE_FILE$ | 19 +++++++++++++++++++ .idea/.gitignore | 4 ++++ .idea/SQL.LetsGetTogether.iml | 9 +++++++++ .idea/dataSources.xml | 11 +++++++++++ .idea/misc.xml | 6 ++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ answers/exercise1.sql | 1 + answers/exercise2.sql | 1 + answers/exercise3.sql | 1 + answers/exercise4.sql | 3 +++ answers/exercise5.sql | 4 ++++ answers/exercise6.sql | 5 +++++ 13 files changed, 78 insertions(+) create mode 100644 .idea/$PRODUCT_WORKSPACE_FILE$ create mode 100644 .idea/.gitignore create mode 100644 .idea/SQL.LetsGetTogether.iml create mode 100644 .idea/dataSources.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/$PRODUCT_WORKSPACE_FILE$ b/.idea/$PRODUCT_WORKSPACE_FILE$ new file mode 100644 index 0000000..3733e0d --- /dev/null +++ b/.idea/$PRODUCT_WORKSPACE_FILE$ @@ -0,0 +1,19 @@ + + + + + + + 1.8 + + + + + + + + \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..bfc8f90 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,4 @@ + +# Datasource local storage ignored files +/dataSources.local.xml +/dataSources/ \ No newline at end of file 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/dataSources.xml b/.idea/dataSources.xml new file mode 100644 index 0000000..99cabc6 --- /dev/null +++ b/.idea/dataSources.xml @@ -0,0 +1,11 @@ + + + + + mysql.8 + true + com.mysql.cj.jdbc.Driver + jdbc:mysql://localhost:3306 + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..28a804d --- /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..56950e7 100644 --- a/answers/exercise1.sql +++ b/answers/exercise1.sql @@ -0,0 +1 @@ +on Enrollments.StudentID = Students.StudentID; \ No newline at end of file diff --git a/answers/exercise2.sql b/answers/exercise2.sql index e69de29..f239774 100644 --- a/answers/exercise2.sql +++ b/answers/exercise2.sql @@ -0,0 +1 @@ +INNER JOIN Students \ No newline at end of file diff --git a/answers/exercise3.sql b/answers/exercise3.sql index e69de29..af3a434 100644 --- a/answers/exercise3.sql +++ b/answers/exercise3.sql @@ -0,0 +1 @@ +RIGHT JOIN Students \ No newline at end of file diff --git a/answers/exercise4.sql b/answers/exercise4.sql index e69de29..3376cd4 100644 --- a/answers/exercise4.sql +++ b/answers/exercise4.sql @@ -0,0 +1,3 @@ +SELECT Country, Count(*) +from Students +Group BY Country \ No newline at end of file diff --git a/answers/exercise5.sql b/answers/exercise5.sql index e69de29..90e1d8e 100644 --- a/answers/exercise5.sql +++ b/answers/exercise5.sql @@ -0,0 +1,4 @@ +SELECT Country, COUNT(*) +FROM Students +GROUP BY Country +ORDER BY Country DESC; \ No newline at end of file diff --git a/answers/exercise6.sql b/answers/exercise6.sql index e69de29..039d5a3 100644 --- a/answers/exercise6.sql +++ b/answers/exercise6.sql @@ -0,0 +1,5 @@ +SELECT Country, COUNT(*) +FROM Students +GROUP BY Country +HAVING COUNT (*) > 10 +ORDER BY Country DESC; \ No newline at end of file From a0343381ba0d8fb6df512e8aa62629b4a502d11f Mon Sep 17 00:00:00 2001 From: David Trombello Date: Wed, 11 Dec 2019 09:03:54 -0500 Subject: [PATCH 2/2] updated 5 and 6 --- answers/exercise5.sql | 2 +- answers/exercise6.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/answers/exercise5.sql b/answers/exercise5.sql index 90e1d8e..8b7ae93 100644 --- a/answers/exercise5.sql +++ b/answers/exercise5.sql @@ -1,4 +1,4 @@ SELECT Country, COUNT(*) FROM Students GROUP BY Country -ORDER BY Country DESC; \ No newline at end of file +ORDER BY COUNT (*) DESC; \ No newline at end of file diff --git a/answers/exercise6.sql b/answers/exercise6.sql index 039d5a3..32a3f7a 100644 --- a/answers/exercise6.sql +++ b/answers/exercise6.sql @@ -2,4 +2,4 @@ SELECT Country, COUNT(*) FROM Students GROUP BY Country HAVING COUNT (*) > 10 -ORDER BY Country DESC; \ No newline at end of file +ORDER BY COUNT (*) DESC; \ No newline at end of file