标签:hid san nan correct names layer hal avl state
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 | ||
| ... | ||||
eteam JOIN game ON (id=team1)
eteam JOIN game ON (id=team2)
eteam JOIN goal ON (teamid=id)
game JOIN goal ON (id=matchid)
game JOIN goal ON (team1=teamid OR team2=teamid)
gtime, mdate, stadium, matchid
mdate, stadium, id
matchid, teamid, player, gtime, id, teamname, coach
matchid, teamid, player, gtime, mdate, stadium, team1
stadium, team1, team2
SELECT player, teamid, COUNT(*)
FROM game JOIN goal ON matchid = id
WHERE (team1 = "GRE" OR team2 = "GRE")
AND teamid != ‘GRE‘
GROUP BY player, teamid
SELECT player, teamid, COUNT(*)
FROM game JOIN goal ON matchid = id
WHERE (team1 = "GRE") AND teamid != ‘GRE‘
GROUP BY player, teamid
SELECT player, teamid, COUNT(*)
FROM game JOIN goal ON matchid = id
WHERE (team1 = "POL" OR team2 = "POL")
AND teamid != ‘POL‘
GROUP BY player, teamid
SELECT player, teamid, COUNT(*)
FROM game JOIN goal WITH matchid = id
WHERE (team1 = "GRE" OR team2 = "GRE")
AND teamid != ‘GRE‘
GROUP BY player, teamid
SELECT player, teamid
FROM game JOIN goal ON matchid = id
WHERE (team1 = "GRE" OR team2 = "GRE")
AND teamid != ‘GRE‘
GROUP BY player, teamid
SELECT DISTINCT teamid, mdate
FROM goal JOIN game on (matchid=id)
WHERE mdate = ‘9 June 2012‘
| DEN | 9 June 2012 |
| GER | 9 June 2012 |
| DEN |
| GER |
| DEN | 9 June 2012 |
| DEN | 9 June 2012 |
| POL | 9 June 2012 |
| RUS | 9 June 2012 |
| GRE |
| CZE |
| POL |
| RUS |
| RUS | 9 June 2012 |
| GRE | 9 June 2012 |
| RUS | 9 June 2012 |
| CZE | 9 June 2012 |
SELECT DISTINCT player, teamid
FROM game JOIN goal ON matchid = id
WHERE stadium = ‘National Stadium, Warsaw‘
AND (team1 = ‘GER‘ OR team2 = ‘GER‘)
AND teamid != ‘GER‘
SELECT DISTINCT player, teamid
FROM game JOIN goal ON matchid = id
WHERE stadium = ‘National Stadium, Warsaw‘
AND (team1 = ‘POL‘ OR team2 = ‘POL‘)
AND teamid != ‘POL‘
SELECT DISTINCT player, teamid
FROM game JOIN goal ON matchid = id
WHERE stadium = ‘National Stadium, Warsaw‘ AND teamid != ‘POL‘
SELECT DISTINCT player, teamid
FROM game JOIN goal ON matchid = id
WHERE stadium = ‘Stadion Miejski (Wroclaw)‘
AND (team1 = ‘POL‘ OR team2 = ‘POL‘)
AND teamid != ‘POL‘
SELECT DISTINCT stadium, mdate
FROM game JOIN goal ON matchid = id
WHERE stadium = ‘National Stadium, Warsaw‘
AND (team1 = ‘POL‘ OR team2 = ‘POL‘)
AND teamid != ‘POL‘
SELECT DISTINCT player, teamid, gtime
FROM game JOIN goal ON matchid = id
WHERE stadium = ‘National Stadium, Warsaw‘
AND (( teamid = team2 AND team1 != ‘ITA‘) OR ( teamid = team1 AND team2 != ‘ITA‘))
SELECT DISTINCT player, teamid, gtime
FROM game JOIN goal ON matchid = id
WHERE stadium = ‘Stadion Miejski (Wroclaw)‘
AND (( teamid = team2 AND team1 != ‘ESP‘) OR ( teamid = team1 AND team2 != ‘ESP‘))
SELECT DISTINCT player, teamid, gtime
FROM game JOIN goal ON matchid = id
WHERE stadium = ‘Stadion Miejski (Wroclaw)‘
AND (( teamid = team2 AND team1 != ‘ITA‘) OR ( teamid = team1 AND team2 != ‘ITA‘))
SELECT DISTINCT teamid, gtime
FROM game JOIN goal ON matchid = id
WHERE stadium = ‘Stadion Miejski (Wroclaw)‘
AND (( teamid = team2 AND team1 != ‘ITA‘) OR ( teamid = team1 AND team2 != ‘ITA‘))
SELECT DISTINCT player, teamid, gtime
FROM game JOIN goal ON matchid = id
WHERE team1 != ‘ITA‘ AND team2 !=‘ITA‘
SELECT teamname, COUNT(*)
FROM eteam JOIN goal ON teamid = id
GROUP BY teamname
HAVING COUNT(*) < 3
| 2 |
| 2 |
| 1 |
| 2 |
| Netherlands | 2 |
| Poland | 2 |
| Republic of Ireland | 1 |
| Ukraine | 2 |
| Netherlands |
| Poland |
| Republic of Ireland |
| Ukraine |
| Poland | 76 |
| Republic of Ireland | 1 |
标签:hid san nan correct names layer hal avl state
原文地址:http://www.cnblogs.com/tk55/p/6758384.html