la diferencia entre los valores en SQL
SELECT
city,
year,
population_needing_house,
LAG(population_needing_house)
OVER (PARTITION BY city ORDER BY year ) AS previous_year
population_needing_house - LAG(population_needing_house)
OVER (PARTITION BY city ORDER BY year ) AS difference_previous_year
FROM housing
ORDER BY city, year
Weary Wombat