Advertisement
niamulhasan

QUery Only

Mar 27th, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1.  
  2.  
  3. -- Answere of Question 5
  4.  
  5. SELECT Country, TeamCaptain, TeamCoach
  6. FROM `team`
  7. WHERE Country LIKE '%l%' AND MatchWon > 50
  8.  
  9.  
  10.  
  11. -- Answere of Question 6
  12.  
  13. UPDATE matchinfo
  14. SET Score = '67'
  15. WHERE MatchID = 2008
  16.  
  17.  
  18.  
  19.  
  20. -- Answere of Question 7
  21.  
  22. SELECT * FROM `team`
  23. WHERE MatchWon BETWEEN 30 AND 150 OR MatchLost BETWEEN 96 AND 37
  24.  
  25.  
  26.  
  27. --Answere to Question 8
  28.  
  29. DELETE FROM team
  30. WHERE TeamId = 1007
  31.  
  32.  
  33. --Answere of Question 9
  34.  
  35. ALTER TABLE matchinfo
  36. ADD FOREIGN KEY (TeamId) REFERENCES team(TeamId);
  37.  
  38.  
  39.  
  40. --ANswere to Question 10
  41.  
  42. SELECT team.Country, matchinfo.Score
  43. FROM team
  44. RIGHT JOIN matchinfo
  45. ON team.TeamId = matchinfo.TeamId
  46. WHERE (select matchinfo.MatchID, sum(matchinfo.Score)
  47. group by MatchID) > 100
  48.  
  49.  
  50.  
  51. --Answere to QUestion 11
  52.  
  53. select team.Country, count(matchinfo.TeamId) as Count
  54. from team
  55. left outer join matchinfo on team.TeamId = matchinfo.TeamId
  56. group by team.TeamId
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67. SELECT DISTINCT team.Country, team.MatchWon, team.MatchLost, team.TeamCaptain, team.TeamCoach
  68. FROM team
  69. RIGHT JOIN matchinfo
  70. ON team.TeamId = matchinfo.TeamId
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement