SQL-SQL_Zoo
SQL-SQL_Zoo copied to clipboard
Tutorial exercises completed from http://sqlzoo.net/
**used multiple group by** SELECT matchid, mdate, COUNT(player) as 'goals scored' FROM goal JOIN game ON matchid = id WHERE 'POL' IN (team1, team2) GROUP BY matchid,mdate
Your correct code ``` SELECT DISTINCT player FROM game JOIN goal ON goal.matchid = game.id WHERE (team1 = 'GER' OR team2 = 'GER') AND teamid 'GER' ``` My wrong code...
In 13, it should be left join because the results are displayed as score1 0,score2 0 even though there is no goal
SQL zoo solution
An INNER JOIN only returns games where there have been goals, i.e. matches between the goal and game table LEFT JOIN will include it.
Adds answers for questions 7-13 of this tutorial
Added 'Barack Obama' to Show all details of the presidential winners
Group by query fire with multiple column
Two more programs are added and alternate way of writing the 8th program is added.