Created
June 4, 2019 15:23
-
-
Save Morzanne/f8701c681745e979d1c3f3e1ded40a9b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT team.name, COUNT(wizard.id) AS total FROM player | |
JOIN wizard ON player.wizard_id = wizard.id | |
JOIN team ON player.team_id=team.id | |
GROUP BY team.name | |
ORDER BY COUNT(wizard.id) DESC; | |
SELECT team.name FROM player | |
JOIN team ON player.team_id=team.id | |
GROUP BY team.name | |
HAVING COUNT(player.wizard_id)>=14; | |
SELECT wizard.firstname FROM player | |
JOIN wizard ON player.wizard_id=wizard.id | |
JOIN team ON player.team_id=team.id | |
WHERE DATE_FORMAT(player.enrollment_date, "%a")="Mon" | |
AND team.name="Gryffindor" | |
ORDER BY player.enrollment_date ASC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment