Getting started with nested subqueries
Time to take your subqueries up a gear! You only have time to watch so much soccer, and want to know if the England Premier League is exciting as people say.
You'll compare the maximum number of goals scored in a single match across each season against the maximum for the England Premier League.
Bu egzersiz, kursun bir parçasıdır
Data Manipulation in SQL
Egzersiz talimatları
- Complete a nested subquery to select the
country_idfor'England Premier League'fromleague, which will be used to filter the parent subquery.
Uygulamalı etkileşimli egzersiz
Bu egzersizi bu örnek kodu tamamlayarak deneyin.
SELECT
season,
MAX(home_goal + away_goal) AS max_goals,
(SELECT MAX(home_goal + away_goal)
FROM match
WHERE season = main.season
-- Subquery to get the max goals in an 'England Premier League' match for the same season
AND country_id IN (____)
) AS pl_max_goals
FROM match AS main
GROUP BY season;