Prüfpunkte
BQ Query most goals scored
/ 35
BQ Query most attempted passes
/ 35
BQ Query penalty kick success
/ 30
BigQuery Soccer Data Analysis
GSP849
Overview
In this lab, you will learn more fundamentals of sports data science by writing and executing queries to query data stored in BigQuery tables. The emphasis of the lab is to illustrate how the database works and answer some interesting questions related to the following topics in soccer.
- Most total goals scored.
- Most attempted passes.
- Best penalty success rate.
The data used in this lab comes from the following sources:
- Pappalardo et al., (2019) A public data set of spatio-temporal match events in soccer competitions, Nature Scientific Data 6:236, https://www.nature.com/articles/s41597-019-0247-7
- Pappalardo et al. (2019) PlayerRank: Data-driven Performance Evaluation and Player Ranking in Soccer via a Machine Learning Approach. ACM Transactions on Intelligent Systems and Technologies (TIST) 10, 5, Article 59 (September 2019), 27 pages. DOI: https://doi.org/10.1145/3343172
Objectives
In this lab, you will learn how to:
- Query soccer match event data in BigQuery.
- Write and execute queries that join information from multiple tables.
Setup and requirements
Before you click the Start Lab button
Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources will be made available to you.
This hands-on lab lets you do the lab activities yourself in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials that you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
- Access to a standard internet browser (Chrome browser recommended).
- Time to complete the lab---remember, once you start, you cannot pause a lab.
How to start your lab and sign in to the Google Cloud console
-
Click the Start Lab button. If you need to pay for the lab, a pop-up opens for you to select your payment method. On the left is the Lab Details panel with the following:
- The Open Google Cloud console button
- Time remaining
- The temporary credentials that you must use for this lab
- Other information, if needed, to step through this lab
-
Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).
The lab spins up resources, and then opens another tab that shows the Sign in page.
Tip: Arrange the tabs in separate windows, side-by-side.
Note: If you see the Choose an account dialog, click Use Another Account. -
If necessary, copy the Username below and paste it into the Sign in dialog.
{{{user_0.username | "Username"}}} You can also find the Username in the Lab Details panel.
-
Click Next.
-
Copy the Password below and paste it into the Welcome dialog.
{{{user_0.password | "Password"}}} You can also find the Password in the Lab Details panel.
-
Click Next.
Important: You must use the credentials the lab provides you. Do not use your Google Cloud account credentials. Note: Using your own Google Cloud account for this lab may incur extra charges. -
Click through the subsequent pages:
- Accept the terms and conditions.
- Do not add recovery options or two-factor authentication (because this is a temporary account).
- Do not sign up for free trials.
After a few moments, the Google Cloud console opens in this tab.
Task 1. Open BigQuery
The BigQuery console provides an interface to query tables, including public datasets offered by BigQuery.
- In the Cloud Console, from the Navigation menu select BigQuery:
The Welcome to BigQuery in the Cloud Console message box opens. This message box provides a link to the quickstart guide and the release notes.
- Click Done.
The BigQuery console opens.
Once the tables are created the display will be similar to this:
In the next section, begin to learn the fundamentals of creating queries in BigQuery.
Task 2. Matches with the most goals
In this section, create a query that joins together multiple tables featuring soccer data. Based on the information available, you can perform some basic analytics such as the most total goals scored in a match by both teams (in a specific league).
- In the Query editor, click "+" (Create SQL query).
- Add the following query to the query Editor:
Here is what the query will do:
- joins the matches table (which has final scores) with the competitions table.
- filter down to "Spanish first division" matches only.
- order by a calculated field that represents total goals in a match.
- Click Run.
The results are displayed below the query window.
Click Check my progress to verify the objective
In this section BigQuery was used to illustrate how to define a query that shows soccer information. The query creates a filter that displays specific information about matches from a specific league and enables the information to be categorized by a defined field.
Task 3. Players with the most passes
In this section, create a query that joins together multiple tables featuring soccer data. Based on the information available, you can perform some basic analytics such as total passes by players.
- In the Query editor, click "+" (Create SQL query).
- Add the following query into the query Editor:
This query:
- joins the events table (which has a record of every pass) with the players table to get player names from their IDs
- groups by player
- counts the number of passes for each one
- orders by the players with the most passes
- Click Run. The results are displayed below the query window.
Click Check my progress to verify the objective
In this section BigQuery was used to illustrate how to define a query that shows player information. The query creates a join that displays specific information about a playerId and enables the information to be categorized by a defined field.
In the next section learn more about the existing dataset and explore how it can be used to determine the penalty kick success rate of players.
Task 4. Determine penalty kick success rate
In this section, create a query that joins together multiple tables featuring soccer data. Based on the information available, you can perform some analytics such as the success rate on penalty kicks by each player.
- In the Query editor, click "+" (Create SQL query).
- Copy and paste the following query into the query Editor:
The query aggregates the number of penalty kick attempts and successful ones by player and filters to those with at least 5 penalty kick attempts before ordering by success rate.
- Click Run. The results are displayed below the query window.
Click Check my progress to verify the objective
In this section BigQuery was used to illustrate how to define a query that shows player information relating to penalty kicks. The query creates a join that displays specific information about a playerId and enables more detailed information to be displayed.
Task 5. Pop quiz
Test your understanding of BigQuery by completing the short quiz on the topics covered in this lab.
Congratulations!
Congratulations! In this lab, you have successfully written and executed queries to analyze data stored in BigQuery tables. You have also learned how to join information from multiple tables to answer interesting questions about soccer.
Google Cloud training and certification
...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.
Manual Last Updated January 25, 2024
Lab Last Tested January 25, 2024
Copyright 2024 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.