Exercise

The match is OVER

The OVER() clause allows you to pass an aggregate function down a data set, similar to subqueries in SELECT. The OVER() clause offers significant benefits over subqueries in select -- namely, your queries will run faster, and the OVER() clause has a wide range of additional functions and clauses you can include with it that we will cover later on in this chapter.

In this exercise, you will revise some queries from previous chapters using the OVER() clause.

Instructions

100 XP
  • Select the match ID, country name, season, home, and away goals from the match and country tables.
  • Complete the query that calculates the average number of goals scored overall and then includes the aggregate value in each row using a window function.