Skip to content

Instantly share code, notes, and snippets.

@harsha547
Created December 20, 2016 10:40
Show Gist options
  • Select an option

  • Save harsha547/c1ee25775664631e3097b525a335f465 to your computer and use it in GitHub Desktop.

Select an option

Save harsha547/c1ee25775664631e3097b525a335f465 to your computer and use it in GitHub Desktop.
-- Team, Year wise bpundaries
-- Team, Year wise bpundaries
SELECT Team.Team_Name,season.season_year,
Sum (CASE
WHEN batsman_scored.runs_scored = 4 THEN 1
ELSE 0
END) AS 'Fours',
Sum (CASE
WHEN batsman_scored.runs_scored = 6 THEN 1
ELSE 0
END) AS 'Sixes'
FROM MATCH
INNER JOIN season
ON match.season_id = season.season_id
INNER JOIN batsman_scored
ON batsman_scored.match_id = match.match_id
INNER JOIN Team
ON Match.Team_1 = Team.Team_Id
GROUP BY Team.Team_Name,Season.season_year
@harsha547
Copy link
Copy Markdown
Author

Result 👍

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment