Exercise 4
Create Table for Aggregate Global Emissions and Temperatures
To analyze the relationship between global emissions and temperatures, you will perform an INNER JOIN between the results of two views: aggregate_global_emissions
and aggregate_global_temperatures
. This join will combine the data from both views based on the common "Year" column.
To create a table called aggregate_global_emissions_temperatures
with the desired columns in the global_temperatures
schema:
- Perform an INNER JOIN between the
aggregate_global_emissions
andaggregate_global_temperatures
table on the "Year" column. - Select the following columns from the joined data:
- YEAR: Integer
- TOTALEMISSIONS: Float
- LANDAVERAGETEMPERATURE: Float
- LANDMAXTEMPERATURE: Float
- LANDMINTEMPERATURE: Float
- LANDANDOCEANAVERAGETEMPERATURE: Float
Your output table, aggregate_global_emissions_temperatures
, should have the above schema.
Sample Output
YEAR | TOTALEMISSIONS | LANDAVERAGETEMPERATURE | LANDMAXTEMPERATURE | LANDMINTEMPERATURE | LANDANDOCEANAVERAGETEMPERATURE |
---|---|---|---|---|---|
1991 | 88534.588762 | 9.179416667 | 9.774 | -0.129 | 15.598 |
2000 | 92645.114758 | 9.201166667 | 9.863 | -1.333 | 15.610666667 |
note
In the SQL statement, the use of double quotes around the YEAR column name is necessary because it is a reserved keyword in Snowflake.
select "YEAR" FROM TABLE