1. Learn
  2. /
  3. Courses
  4. /
  5. Time Series Analysis in PostgreSQL

Exercise

Temperatures by century

As a data analyst you may be asked to perform ad hoc queries.

You work at a news organization and are in charge of providing data for the daily weather quiz that is posed in the nightly newscast. The meteorologist occasionally asks for your help to create a new weather trivia quiz. This time you are asked to provide the maximum and minimum recorded temperature for each station over each century.

You are given a sample dataset that only provides data for years 2000 through present day, but it should work on a more complete dataset containing data based in any century.

The table temperature_stations provides metadata for each weather station, and temperatures_monthly contains the monthly minimum, maximum, and average temperatures for each month.

Instructions 1/2

undefined XP
    1
    2
  • Get the minimum and maximum monthly temperature for each station for years 2000 through present day, using DATE_TRUNC(); use columns year_month, t_monthly_min, and t_monthly_max.