Created
April 18, 2015 08:11
-
-
Save dnasca/2dbe1370acca643e6605 to your computer and use it in GitHub Desktop.
This query asks - Who are all the players between 1900 and 2014 with over 5000 at bats, include AB, BBPERC, SOPERC, and AVG, sort by SOPERC lowest->highest (Strike-out percentage)
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
| ##Using the baseball statistics dB found at http://www.seanlahman.com/baseball-archive/statistics/ | |
| SELECT | |
| b.playerID, | |
| CONCAT(m.nameFirst, ' ', m.nameLast) AS NAME, | |
| SUM(b.AB) AS AB, | |
| ROUND(b.bb / (b.AB + b.BB + b.HBP + COALESCE(b.SF, 0)) * 100, 2) AS BBPERC, | |
| ROUND(b.so / (b.AB + b.BB + b.HBP + COALESCE(b.SF, 0)) * 100, 2) AS SOPERC, | |
| ROUND(SUM(b.H) / SUM(b.AB), 3) AS AVG | |
| FROM | |
| Batting b, | |
| Master m | |
| WHERE | |
| b.playerID = m.playerID | |
| AND yearID BETWEEN 1900 AND 2014 | |
| GROUP BY b.playerID | |
| HAVING SOPERC > 0 AND BBPERC > 0 AND AB > 5000 | |
| ORDER BY SOPERC ASC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment