Here I continue my Sabermetrics Baseball tutorial. If you missed part one, check it out first because in it I show you how to get all of your tools. It is here Sabermetrics.
I’m going to introduce a few new SQL functions being CONCAT, COALESCE and HAVING.
We will also calculate the top players based on RBIs, HRs, Batting Average, On Base Percentage, and Slugging Percentage. And, I’ll show you how to pull in data on the players position and their salary.
If you like videos like this tell Google [googleplusone]
To make me extra happy, feel free to share it [nttfblike]
Code from the Video
Another good one. thanks for sharing
I’m glad you liked it. I love to completely change subjects like this while reenforcing my current work. This seems to fit in well as a SQL / MySQL refresher. It will also work right back into the Java Tutorial.
hello derek,
I got the output of below query after 9 min 33.45 secs, obviously because batting has 95k entries and master has 17k entries, how do i optimise the query?
For writing an enterp app, if we are in such situation, what should we do to optimise time?
Select b.playerID, m.nameFirst, sum(b.RBI) FROM Batting b , master m where b.playerID = m.playerID group by playerID order by rbi desc limit 50.
Any ideas why your 51 second query took an hour and 15 minutes on my SSD ultrabook? I duplicated it on another Core i5 machine too with similar results. CPU never broke 40% and disk activity wasn’t high. Plenty of memory available. Is there a setting in mysql that you could point me to?
Sorry, but i’m not sure? Maybe the database has changed?