1SELECT
2city,
3 year,
4 population_needing_house,
5 LAG(population_needing_house)
6 OVER (PARTITION BY city ORDER BY year ) AS previous_year
7 population_needing_house - LAG(population_needing_house)
8 OVER (PARTITION BY city ORDER BY year ) AS difference_previous_year
9FROM housing
10ORDER BY city, year
11