Skip to content

Instantly share code, notes, and snippets.

@meneguinha
Last active September 1, 2024 16:13
Show Gist options
  • Save meneguinha/a06aa8740898d8ef231fe8eebc4c317f to your computer and use it in GitHub Desktop.
Save meneguinha/a06aa8740898d8ef231fe8eebc4c317f to your computer and use it in GitHub Desktop.
CNPQ - Biquery
--Total value paid to research projects in BRAZIL by research field
WITH cnpq AS (SELECT ano, processo, beneficiario, palavra_chave, linha_fomento, modalidade, grande_area_conhecimento, area_conhecimento, subarea_conhecimento, pais_origem, pais_destino, valor FROM `basedosdados.br_cnpq_bolsas.microdados`)
SELECT
ano,
grande_area_conhecimento,
ROUND (SUM(valor),0) AS total_valor
FROM
cnpq
GROUP BY
ano,grande_area_conhecimento
ORDER BY
ano, grande_area_conhecimento;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment