1. Belajar
  2. /
  3. Kursus
  4. /
  5. Intermediate SQL

Connected

Latihan

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.

Instruksi

100 XP
  • Select the country and the average budget as average_budget, rounded to two decimal, from films.
  • 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.