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

Connected

Exercise

Find the three highest values per partition

You work for a meteorology observatory and the station director has tasked you with identifying the three highest monthly temperatures for each weather station for the year of 2017. You know that in order to find this you will need to create a window function to number the rows.

Since you are looking for the highest monthly temperatures, you'll want to ensure that you are ordering by the t_monthly_max in descending order so that the highest temperatures are numbered first.

Two tables are available for you: temperatures_monthly and temperature_stations.

Instructions

100 XP
  • Find the three highest monthly temperatures for each station_id and corresponding state, for the year of 2017.