Climate Change #5

https://www.codecademy.com/paths/analyze-data-with-sql/tracks/advanced-sql/modules/sql-window-functions/projects/sql-window-functions-project

Does anyone have the solution for Q5 at the link above? I’m not sure (at all) how to handle nulls. Thanks!

I actually don’t know how to do the subsequent questions either. I used the hints, but I need to compare my code to the solutions.


Need help with the code , thanks in advance.

This is what I have for #5. I don’t know how to handle nulls in the LAG.

SELECT state, year, tempf, tempf-LAG(tempf, 1, ?) OVER (PARTITION BY state

ORDER BY year) AS ‘change_in_temp’

FROM state_climate

ORDER BY change_in_temp;