Difference between revisions of "JOIN Quiz"
From SQLZOO
| Line 136: | Line 136: | ||
- SELECT player, COUNT(*), teamid FROM game JOIN goal WITH matchid = id WHERE (team1 = "GRE" OR team2 = "GRE") AND teamid != 'GRE' GROUP BY player | - SELECT player, COUNT(*), teamid FROM game JOIN goal WITH matchid = id WHERE (team1 = "GRE" OR team2 = "GRE") AND teamid != 'GRE' GROUP BY player | ||
- SELECT player, teamid FROM game JOIN goal ON matchid = id WHERE (team1 = "GRE" OR team2 = "GRE") AND teamid != 'GRE' GROUP BY player | - SELECT player, teamid FROM game JOIN goal ON matchid = id WHERE (team1 = "GRE" OR team2 = "GRE") AND teamid != 'GRE' GROUP BY player | ||
| + | |||
| + | {Select the result that would be obtained from this code: SELECT teamid, mdate FROM goal JOIN game on (matchid=id) WHERE mdate = '9 June 2012' | ||
| + | <table style='float:left'><caption>Table-A</caption><tr><td>DEN</td><td>9 June 2012</td></tr><tr><td>GER</td><td>9 June 2012</td></tr></table> | ||
| + | <table style='float:left'><caption>Table-B</caption><tr><td>DEN</td></tr><tr><td>GER</td></tr></table> | ||
| + | <table style='float:left'><caption>Table-C</caption><tr><td>GRE</td><td>12 June 2012</td></tr><tr><td>CZE</td><td>12 June 2012</td></tr><tr><td>POL</td><td>12 June 2012</td></tr><tr><td>RUS</td><td>12 June 2012</td></tr></table> | ||
| + | <table style='float:left'><caption>Table-D</caption><tr><td>GRE</td></tr><tr><td>CZE</td></tr><tr><td>POL</td></tr><tr><td>RUS</td></tr></table> | ||
| + | <table style='float:left'><caption>Table-E</caption><tr><td>POL</td><td>8 June 2012</td></tr><tr><td>GRE</td><td>8 June 2012</td></tr><tr><td>RUS</td><td>8 June 2012</td></tr><tr><td>CZE</td><td>8 June 2012</td></tr></table> | ||
| + | |type="()"} | ||
| + | + Table-A | ||
| + | - Table-B | ||
| + | - Table-C | ||
| + | - Table-D | ||
| + | - Table-E | ||
{Select the code which would show the player and their team for those who have scored against Poland(POL) in National Stadium, Warsaw. | {Select the code which would show the player and their team for those who have scored against Poland(POL) in National Stadium, Warsaw. | ||
| Line 152: | Line 165: | ||
- SELECT DISTINCT teamid, gtime FROM game JOIN goal ON matchid = id WHERE stadium = 'Stadion Miejski (Wroclaw)' AND (team1 != 'ITA' AND team2 !='ITA') | - SELECT DISTINCT teamid, gtime FROM game JOIN goal ON matchid = id WHERE stadium = 'Stadion Miejski (Wroclaw)' AND (team1 != 'ITA' AND team2 !='ITA') | ||
- SELECT DISTINCT player, teamid, gtime FROM game JOIN goal ON matchid = id WHERE team1 != 'ITA' AND team2 !='ITA' | - SELECT DISTINCT player, teamid, gtime FROM game JOIN goal ON matchid = id WHERE team1 != 'ITA' AND team2 !='ITA' | ||
| + | |||
| + | {Select the result that would be obtained from this code: SELECT teamname, COUNT(*) FROM eteam JOIN goal ON teamid = id GROUP BY teamname HAVING COUNT(*) < 3 | ||
| + | <table style='float:left'><caption>Table-A</caption><tr><td>2</td></tr><tr><td>2</td></tr><tr><td>1</td></tr><tr><td>2</td></tr></table> | ||
| + | <table style='float:left'><caption>Table-B</caption><tr><td>Netherlands</td><td>2</td></tr><tr><td>Poland</td><td>2</td></tr><tr><td>Republic of Ireland</td><td>1</td></tr><tr><td>Ukraine</td><td>2</td></tr></table> | ||
| + | <table style='float:left'><caption>Table-C</caption><tr><td>Netherlands</td></tr><tr><td>Poland</td></tr><tr><td>Republic of Ireland</td></tr><tr><td>Ukraine</td></tr></table> | ||
| + | <table style='float:left'><caption>Table-D</caption><tr><td>Poland</td><td>76</td></tr></table> | ||
| + | <table style='float:left'><caption>Table-E</caption><tr><td>Republic of Ireland</td><td>1</td></tr></table> | ||
| + | |type="()"} | ||
| + | - Table-A | ||
| + | + Table-B | ||
| + | - Table-C | ||
| + | - Table-D | ||
| + | - Table-E | ||
</quiz> | </quiz> | ||
[[Category:Quizzes]] | [[Category:Quizzes]] | ||
Revision as of 11:08, 7 August 2012
JOIN quiz
| id | mdate | stadium | team1 | team2 |
|---|---|---|---|---|
| 1001 | 8 June 2012 | National Stadium, Warsaw | POL | GRE |
| 1002 | 8 June 2012 | Stadion Miejski (Wroclaw) | RUS | CZE |
| 1003 | 12 June 2012 | Stadion Miejski (Wroclaw) | GRE | CZE |
| 1004 | 12 June 2012 | National Stadium, Warsaw | POL | RUS |
| ... | ||||
| matchid | teamid | player | gtime | |
|---|---|---|---|---|
| 1001 | POL | Robert Lewandowski | 17 | |
| 1001 | GRE | Dimitris Salpingidis | 51 | |
| 1002 | RUS | Alan Dzagoev | 15 | |
| 1001 | RUS | Roman Pavlyuchenko | 82 | |
| ... | ||||
| id | teamname | coach | ||
|---|---|---|---|---|
| POL | Poland | Franciszek Smuda | ||
| RUS | Russia | Dick Advocaat | ||
| CZE | Czech Republic | Michal Bilek | ||
| GRE | Greece | Fernando Santos | ||
| ... | ||||