Advertisement
apl-mhd

sqlzoo6

Jul 15th, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.98 KB | None | 0 0
  1. 6.
  2. SELECT mdate, x.teamname as 'teamname 1', y.teamname as 'teamname 2'
  3. FROM ((game join eteam x  on  team1 = x.id )
  4. join eteam y on team2 = y.id)
  5.  
  6. 8.
  7.  
  8. SELECT DISTINCT(player)
  9. FROM game
  10.   JOIN goal ON matchid = id
  11.     WHERE( (team1='GER' or team2='GER')  and teamid !='GER')
  12.    
  13. 9.
  14. SELECT teamname, count(teamid)
  15.  
  16.   FROM eteam JOIN goal ON id=teamid
  17.  
  18. group by teamname
  19.  
  20. 10.
  21. SELECT stadium, count(teamid)
  22. from game join goal on id = matchid
  23. group by stadium
  24.  
  25. 11.
  26. select matchid,mdate,count(teamid)
  27.  
  28. from game join goal on id= matchid
  29.  
  30. and( team1 ='pol' or team2 ='pol')
  31.  
  32. group by matchid
  33.  
  34.  
  35. 12.
  36.  
  37. SELECT matchid, mdate, count(teamid)
  38.  
  39. from  game join  goal on  matchid  = id
  40. and teamid = 'ger'
  41. group by matchid
  42.  
  43.  
  44. 13.
  45. select mdate, team1 ,(select  count(teamid)  from goal where matchid = id  and team1 =teamid) as score,
  46.  
  47. team2, (select  count(teamid)  from goal where matchid = id  and team2 =teamid) as score
  48.  
  49. from game
  50.  
  51. order by mdate,  team1,team2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement