Skip to content

Commit

Permalink
Merge pull request #17 from NSS-Full-Time-Data-Analytics-4/q6
Browse files Browse the repository at this point in the history
Q6
  • Loading branch information
SudeepGhantasala authored Jun 10, 2021
2 parents 4ce4461 + 913bff6 commit ed589f1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions scripts/Teen_Wolf_Q(6)_sudeep.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--question 6
-- Find the player who had the most success stealing bases in 2016,
-- where success is measured as the percentage of stolen base attempts which are successful.
-- (A stolen base attempt results either in a stolen base or being caught stealing.)
-- Consider only players who attempted at least 20 stolen bases.

select namefirst, namelast,(sb::numeric/(sb::numeric+cs::numeric)) as stolen_success_percentage
from batting
left join people
using(playerid)
where yearid=2016 and (sb+cs) >20
order by (sb::numeric/(sb::numeric+cs::numeric)) desc
limit 1

0 comments on commit ed589f1

Please sign in to comment.