Created
April 18, 2015 07:48
-
-
Save dnasca/b0eb904958affa00a519 to your computer and use it in GitHub Desktop.
This query will return some offensive stats on the 1995 ATL Braves players with >= 300 AB's during that season, sorted by AB's.
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
| SELECT | |
| b.playerID, | |
| CONCAT(m.nameFirst, ' ', m.nameLast) AS NAME, | |
| AB, | |
| H, | |
| 2B, | |
| 3B, | |
| HR, | |
| R, | |
| RBI, | |
| SB, | |
| ROUND(BB / (AB + BB + HBP + COALESCE(SF, 0)) * 100, 2) AS BBPERC, #walks percentage | |
| ROUND(SO / (AB + BB + HBP + COALESCE(SF, 0)) * 100, 2) AS SOPERC, #strikeout percentage | |
| ROUND((H / AB), 3) AS AVG, | |
| (H + BB + HBP) / (AB + BB + HBP + SF) AS OBP, | |
| (H + 2B + 2 * 3B + 3 * HR) / AB AS SLG | |
| FROM | |
| Batting b, | |
| Master m | |
| WHERE | |
| b.playerID = m.playerID | |
| AND yearID = 1995 | |
| AND teamID = 'ATL' | |
| GROUP BY b.playerID | |
| HAVING AB >= 300 | |
| ORDER BY AB DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment