Challenge¶
The public table bigquery-public-data.ncaa_basketball.mbb_games_sr
contains the results of NCAA mens basketball games. Use this table to determine the most "unfair" venues during the 2016 season, where the number of personal fouls called on the away team was significantly higher than the home team. Specifically,
- Filter the games for season 2016
- Group the data by venue_name
- Exclude venues with fewer than 10 games
- Sort the result by the average difference in personal fouls (home - away, descending)
Expected Result
Bonus
Save the result as a view.
What's a view?
Where is the ncaa_basketball
dataset?
Solution¶
Explanation
Nothing special here - just a plethora of basic SQL functions and clauses used together.
Bonus
Creating a view from a query in BigQuery is easy enough!
-
Click Save > Save View
-
Select a project and dataset, and enter a "table" (view) name
Access Denied Error 🤦♂️
If you get an error like this one,
It's probably because you're attempting to save the view in a different data location than the source table. In BigQuery, views must reside in the same location as their source table. In this case, the source data lives in the US region, so you'll need to save the view in a dataset that also lives in the US region.