Skip to content

Instantly share code, notes, and snippets.

@clrko
Created June 4, 2020 09:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clrko/34e42c4f1417eb840b8ba6c141126f8d to your computer and use it in GitHub Desktop.
Save clrko/34e42c4f1417eb840b8ba6c141126f8d to your computer and use it in GitHub Desktop.
Quest6_database_mysql
SELECT name, COUNT(*)
FROM player
JOIN team
ON player.team_id = team.id
GROUP BY name
ORDER BY COUNT(*) DESC;
SELECT name, COUNT(*)
FROM team
JOIN player
ON player.team_id = team.id
GROUP BY name
HAVING COUNT(*) >= 14;
SELECT firstname, lastname, enrollment_date
FROM wizard
JOIN player
ON wizard.id = player.wizard_id
JOIN team
ON player.team_id = team.id
WHERE team.name = 'Gryffindor' AND DAYOFWEEK(enrollment_date) = 2
ORDER BY enrollment_date ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment