1. Learn
  2. /
  3. Courses
  4. /
  5. Data Manipulation in SQL

Connected

Exercise

Building on Subqueries in FROM

In the previous exercise, you found that England, Netherlands, Germany and Spain were the only countries that had matches in the database where 10 or more goals were scored overall. Let's find out some more details about those matches -- when they were played, during which seasons, and how many of the goals were home versus away goals.

You'll notice that in this exercise, the table alias is excluded for every column selected in the main query. This is because the main query is extracting data from the subquery, which is treated as a single table.

Instructions

100 XP
  • Complete the subquery inside the FROM clause. Select the country name from the country table, along with the date, the home_goal, the away_goal, and the total_goals columns from the match table.
  • Create a column in the subquery that adds home and away goals, called total_goals. This will be used to filter the main query.
  • Select the country, date, home_goal, and away_goal in the main query.
  • Filter the main query for games with 10 or more total goals.