CommencerCommencer gratuitement

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.

Cet exercice fait partie du cours

Time Series Analysis in PostgreSQL

Afficher le cours

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

-- Get the min and max temp for each station per century
SELECT
	ts.state,
	___ AS century,
	___ AS min,
	___ AS max
FROM temperature_stations AS ts
JOIN temperatures_monthly USING(station_id)
GROUP BY state, century
ORDER BY state;
Modifier et exécuter le code