Last active
December 17, 2016 18:43
-
-
Save harsha547/4313053c145174f9ded8fca2b3dbfe27 to your computer and use it in GitHub Desktop.
Matches won by chasing and first_batting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Examples Queries to run on Indian Premier League Database. | |
| -- Matches won by chasing and first_batting | |
| SELECT Team_Name , | |
| SUM( CASE WHEN Toss_Name = 'field' THEN 1 ELSE 0 END ) AS "Chasing", | |
| SUM( CASE WHEN Toss_Name = 'bat' THEN 1 ELSE 0 END ) AS "First_Batting" | |
| FROM | |
| Match | |
| INNER JOIN | |
| Toss_Decision | |
| ON | |
| Match.Toss_Decide = Toss_Decision.Toss_Id | |
| INNER JOIN | |
| Team | |
| ON | |
| Match.Match_Winner = Team.Team_Id | |
| GROUP BY GROUPING SETS ( Team_Name, ()) |
Author
harsha547
commented
Dec 17, 2016

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