Advanced SQL Climate Change

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

Trying to do this project, have no idea what it want me to do. It want’s me to use window functions but makes more sense not too. Why not use MIN() rather than FIRST_VALUE()? FIRST_VALUE gives the temp in 1985 not the lowest_temp.

Had a look at the other topic and there’s a few of us stumbling not knowing what to do.

Can anyone that has done this share or explain how/why you did the steps.

From what I have understood after the completion of the course:

If you simply want to find the lowest_temp of the overall dataset regardless of state, then MIN() works fine.
It is when you want to find the lowest_temp for each state that window function works well.
With a traditional MIN() you would have to include where clauses to filter by state and even then you would have to inlcude many queries to get each state’s lowest_temp.
Window Functions give you the power of having that info with one simple querie in one result table.

IN YOUR QUERIES:
You are missing the vital ORDER BY inside the OVER clauses. Remember that the definition of FIRST AND LAST VALUE is that they provide the first/last item of an ORDERED SET. So using ORDER BY is tryl vital for the process.

I hope that I have been of some help.