Created
April 11, 2025 16:48
-
-
Save fernandobarbalho/a7ac3476e8ca31afdfae381328320317 to your computer and use it in GitHub Desktop.
Busca a proporção de servidores com nível superior para os municípios brasileiros usando dados da RAIS
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
# Os dados estão presentes no repositório big query da base dos dados | |
SELECT id_municipio, | |
count(*) as quantidade_nivel_superior, | |
( select count(*) | |
from `basedosdados.br_me_rais.microdados_vinculos` vinc_sub | |
where vinc_sub.id_municipio = vinc.id_municipio and | |
ano = 2023 and | |
vinculo_ativo_3112 ="1" and | |
natureza_juridica = "1244") as total_servidores_municipio, #1244= município | |
(count(*)/( select count(*) | |
from `basedosdados.br_me_rais.microdados_vinculos` vinc_sub | |
where vinc_sub.id_municipio = vinc.id_municipio and | |
ano = 2023 and | |
vinculo_ativo_3112 ="1" and | |
natureza_juridica = "1244"))*100 as proporcao_nivel_superior | |
FROM `basedosdados.br_me_rais.microdados_vinculos` vinc | |
where cnae_2 = "84116" and #administração pública | |
ano = 2023 and | |
vinc.vinculo_ativo_3112 ="1" and | |
natureza_juridica = "1244" and #município | |
grau_instrucao_apos_2005 in ("09","10","11") #nível superior, mestrado e doutorado | |
group by id_municipio | |
order by id_municipio |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment