1. Learn
  2. /
  3. Courses
  4. /
  5. Improving Query Performance in PostgreSQL

Exercise

Where winter is white

Canada, Russia, and Mongolia are the only countries with Olympians and average annual temperatures below freezing. More commonly, countries have cold weather occurring only during winter months. Countries with only a few months of freezing temperatures and snow still provide athletes the opportunity to train for events like skiing and bobsledding.

With this in mind, you will look at climate data for countries with Olympic athletes using the 40-year average monthly temperatures. You are really intrigued by the low Winter Olympics participation in Africa and decide to look at the temperature for all the Olympic regions in the southern hemisphere.

Write the query to optimize for readability by using a common table expression (CTE).

Instructions

100 XP
  • Write a CTE, south_cte for the southern hemisphere.
  • Find the average June temperature and precipitation from the oclimate table.
  • Join the results to view the average winter month temperature for all regions.