Skip to content

Instantly share code, notes, and snippets.

@harsha547
Created April 10, 2017 22:03
Show Gist options
  • Save harsha547/397c5a225a8cb55a4484459b6fa6609b to your computer and use it in GitHub Desktop.
Save harsha547/397c5a225a8cb55a4484459b6fa6609b to your computer and use it in GitHub Desktop.
Metrics in Indian Premier League ( 2008 - 2016 )
-- Important metrics in IPL ( 2008 - 2016 )
SELECT 'Matches' As Dimension , COUNT(*) As 'Measure'
FROM Match
UNION ALL
SELECT 'Extra_Runs' As Dimension , SUM(Extra_Runs.Extra_Runs) As 'Measure'
FROM Extra_Runs
UNION ALL
SELECT 'Batsman_runs' As Dimension , SUM(B.Runs_Scored) As 'Value'
FROM Batsman_Scored B
UNION ALL
SELECT 'Wickets' As Dimension , COUNT(*) As 'Measure'
FROM Wicket_Taken
UNION ALL
SELECT 'Sixes' As Dimension , COUNT(*) As 'Measure'
FROM Batsman_Scored
WHERE Batsman_Scored.Runs_Scored = 6
UNION ALL
SELECT 'Fours' As Dimension , COUNT(*) As 'Measure'
FROM Batsman_Scored
WHERE Batsman_Scored.Runs_Scored = 4
@harsha547
Copy link
Author

Solution 👍

image

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