Created
September 17, 2021 09:16
-
-
Save allenday/cd1b2e27417874a7407ea5caa38f7cdb to your computer and use it in GitHub Desktop.
worldpop population density per country 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
country_name, | |
COUNT(1) AS hectares, | |
SUM(population) AS total_pop, | |
SUM(population)/COUNT(1) AS pop_per_hectare | |
FROM | |
`bigquery-public-data.geo_worldpop.WorldPop_GP_100m` AS pop | |
,`bigquery-public-data.country_codes.country_codes` AS codes | |
WHERE TRUE | |
AND pop.country_code = codes.alpha_3_code | |
AND pop.population >= 0 | |
AND pop.year = 2020 | |
GROUP BY country_name | |
ORDER BY pop_per_hectare DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment