MulaiMulai sekarang secara gratis

Average total country medals by region

Layered calculations are when you create a basic query with an aggregation, then reference that query as a subquery to run an additional calculation. This approach allows you to run aggregations on aggregations, such as a MAX() of a COUNT() or an AVG() of a SUM().

In this exercise, your task is to pull the average total_golds for all countries within each region. This report will apply only for summer events.

To avoid having to deal with null handling, we have created a summer_games_clean table. Please use this when building the report.

Latihan ini adalah bagian dari kursus

Reporting in SQL

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

-- Query total_golds by region and country_id
SELECT 
	____, 
    ____, 
    ____ AS total_golds
FROM ____ AS s
JOIN ____ AS c
ON ____
GROUP BY ____;
Edit dan Jalankan Kode