Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

finito #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
24 changes: 24 additions & 0 deletions answers/exercise1.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
USE myNewDb;
CREATE TABLE Enrollments(
StudentId int,
StudentName VARCHAR(255));
CREATE TABLE Learners(
StudentId int,
StudentName VARCHAR(255));
INSERT INTO Enrollments(
StudentId,
StudentName)
VALUES(
4,
'Mike');
SELECT * FROM Enrollments;
INSERT INTO Learners(
StudentId,
StudentName)
VALUES(
7,
'Takeoff');
SELECT * FROM Enrollments
RIGHT JOIN Learners
ON Enrollments.StudentId
= Learners.StudentId;
4 changes: 4 additions & 0 deletions answers/exercise2.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SELECT * FROM Enrollments
INNER JOIN Learners
ON Enrollments.StudentId
= Learners.StudentId;
4 changes: 4 additions & 0 deletions answers/exercise3.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SELECT * FROM Enrollments
RIGHT JOIN Learners
ON Enrollments.StudentId
= Learners.StudentId;
3 changes: 3 additions & 0 deletions answers/exercise4.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SELECT COUNT( * ), Country
FROM Students
GROUP BY Country;
4 changes: 4 additions & 0 deletions answers/exercise5.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SELECT COUNT( * ), Country
FROM Students
GROUP BY Country
ORDER BY COUNT(*) DESC;
5 changes: 5 additions & 0 deletions answers/exercise6.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SELECT COUNT( * ), Country
FROM Students
GROUP BY Country
HAVING COUNT(*) > 10
ORDER BY COUNT(*);