Skip to content

Instantly share code, notes, and snippets.

@lfy79001
Created March 28, 2024 07:08
Show Gist options
  • Save lfy79001/8332202c81159ab593f11a606d3e5c04 to your computer and use it in GitHub Desktop.
Save lfy79001/8332202c81159ab593f11a606d3e5c04 to your computer and use it in GitHub Desktop.
SELECT
city, AVG(value) as avg_aqi, latitude, longitude
FROM
`bigquery-public-data.openaq.global_air_quality`
WHERE
pollutant = 'pm25'
AND (city = 'Beijing' OR city = 'Shanghai')
AND EXTRACT(YEAR FROM timestamp) BETWEEN 2017 AND 2021
GROUP BY
city, latitude, longitude
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment