HAVING and sorting
Filtering and sorting go hand in hand and gives you greater interpretability by ordering our results.
Let's see this magic at work by writing a query showing what countries have the highest average film budgets.
Latihan ini merupakan bagian dari kursus
Intermediate SQL
Instruksi latihan
- Select the
countryand the average budget asaverage_budget, rounded to two decimal, fromfilms. - Group the results by
country. - Filter the results to countries with an average budget of more than one billion (
1000000000). - Sort by descending order of the
average_budget.
Latihan interaktif langsung praktik
Cobalah latihan ini dengan melengkapi kode contoh ini.
-- Select the country and average_budget from films
___
-- Group by country
___
-- Filter to countries with an average_budget of more than one billion
___
-- Order by descending order of the aggregated budget
___