Giter Site home page Giter Site logo

ncaa-sql-exercise's Introduction

NCAA-SQL-Exercise

Is your team more likely to win a game hitting free throws or 3-pointers in NCAA basketball?

In this SQL exercise, we will explore NCAA games between 2013 and 2018 to statistically determine if hitting free throws or 3-pointers is more important to winning NCAA basketball games.

The NCAA has taken both sides of this argument

In October 2018, the NCAA published the article titled, The 3-pointer really does help you win NCAA games. Then 2 months later (December 2018), the NCAA published, Why the free throw is the most important shot in college basketball.

We will use Google Cloud's Big Query product and their NCAA Basketball dataset to quickly evaluate thousands of basketball game stats and come to an analytical conclusion.

Methodology

We'll review wins and losses of the highest percentage of 3-point scoring games vs. highest percentage of made free throws in NCAA games. When we first pulled the data, there were a few games where only two free throws or one 3-pointer was attempted.

Number of Games

We'll evaluate the success percentages in the top 500 games

  • Top 500 games of percent successful free throws
  • Top 500 games of percent successful 3-pointers

Minimum Thresholds

  • At least ten free throws attempted by the team in a game
  • At least five 3-pointers attempted by the team in a game

Prerequisites

  1. Sign-in or Sign-up for a Google Cloud account.
    Since we're using Google Cloud's Big Query, you'll need to sign up for a Google Cloud account. If you don't already have a Google Cloud account, go to Big Query, and click "Try Big Query free."

  1. Select your project, or create a new project in Google Cloud.

  1. Enter and Select "bigquery" in the search console.

Free Throw SQL Query

  1. Once you enter the BigQuery product, you should default to SQL workplace and a default Editor should appear.
  2. Copy and paste the SQL code bestfreethrowpercentages.sql into the Editor

Free Throw SQL Code Review

Taking a quick look at the code, you'll notice:

  • We created columns to view the following:
    • Free Throws Attempted
    • Free Throws Made
    • Free Throws Percent
    • Did the team win?
  • We filtered out for opposing teams that also made 100% of their free throws (unlikely, but we wanted to remove anomalies).
  • We filtered out all games where the team had less than 10 free throw attempts.
  • We sorted by highest percent of free throws made.
  • The table only includes the top 500 games of the highest free throw percentage.
  1. Click "Run" You'll see a table of results appear at the bottom of the screen. Now let's take a look at the data, you should see the first 50 rows of data, games with the highest percent free throws.

You might notice that the first 50 rows have 100% free throw percentage made. Wow that's pretty good! But then look at the "win" column and you'll find that they didn't automatically win the games.

  1. Let's export the data to take a closer look. I chose .CSV, but you're welcome to choose the method that is most comfortable for you.

  1. Let's count how many games of the 500 highest free throws made percentage were won. I used the COUNTIF function (you can use any method you'd like). I counted 306 games or 61% of games were won where the team had the highest percent of free throws.

Next, let's repeat the process for 3-pointers.

3-pointer SQL Query

  1. In the Editor, Select all SQL code and replace with the bestthreepointerspercentages.sql SQL code.

3-Pointer SQL Code Review

Taking a quick look at the code, you'll notice:

  • We created columns to view the following:
    • 3-Pointers Attempted
    • 3-Pointers Made
    • 3-Pointers Made Percent
    • Did the team win?
  • We filtered out all games where the team had less than five 3-pointer attempts
  • We sorted by highest percent of 3-pointers made
  • The table only includes the top 500 games of the highest 3-pointers made percentage
  1. Click "Run" You'll see a table of results appear at the bottom of the screen. Now let's take a look at the data, you should see the first 50 rows of data, games with the highest percent 3-pointers

  1. Let's export the data to take a closer look. I chose .CSV(local file), but you're welcome to choose the method that works best for you.
  2. Let's count how many games of the 500 highest 3-pointers made percentage were won.

I used the COUNTIF function (you can use any method you'd like). I counted 440 of 500 games or 88% of games were won where the team had the highest percentage of successful 3-pointers.

Conclusion

Free Throws or 3-pointers?

  • Teams with the highest percent of free throws in the top 500 games, won 61% of the time.
  • Teams with the highest percent of successful 3-pointers in the top 500 games, won 88% of the time.

Therefore, teams who make a higher percentage of making 3-pointers are more likely to win than a team that makes all of their free throws.

In reality, this issue is significantly more complex than statistically analyzing free throws vs. 3-pointers. For example, a team in the lead will get a lot more free throw attempts as the losing team will foul to get possession of the ball.

What's my connection?

From 2017-2019, I attended 34 out of 39 Georgia Tech Men's Basketball home games and learned a lot about losing.

Since then I started attending Georgia Tech Women's Basketball games and watched their journey to the NCAA Sweet Sixteen in 2021.

ncaa-sql-exercise's People

Contributors

carolinedunn avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.