Get startedGet started for free

GROUP BY multiple fields

GROUP BY becomes more powerful when used across multiple fields or combined with ORDER BY and LIMIT.

Perhaps you're interested in learning about budget changes throughout the years in individual countries. You'll use grouping in this exercise to look at the maximum budget for each country in each year there is data available.

This exercise is part of the course

Intermediate SQL

View Course

Exercise instructions

  • Select the release_year, country, and the maximum budget aliased as max_budget for each year and each country; sort your results by release_year and country.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

-- Find the release_year, country, and max_budget, then group and order by release_year and country
___
Edit and Run Code