Q9 | Guess the question

Question

All you have to do is to go through the code and comment the question for which the following is an answer of

SELECT mdate,
team1,
SUM(CASE WHEN teamid = team1 THEN 1 ELSE 0 END) AS score1,
team2,
SUM(CASE WHEN teamid = team2 THEN 1 ELSE 0 END) AS score2 FROM
game LEFT JOIN goal ON (id = matchid)
GROUP BY mdate,team1,team2
ORDER BY mdate, matchid, team1, team2
in progress 0
TheDataMonk 4 years 1 Answer 465 views Grand Master 0

Answer ( 1 )

  1. Write a query to fetch all the team1,team2 name and their respective scores(win team score = 1 , lose team score = 0), even if team haven`t done any goal in the match.
    select the columns in this order matchdate,team1,score1,team2,score2.
    The records should be in the order of matchdate,matchid,team1,team2.

Leave an answer

Browse
Browse