[ { "id": "environmental_registry_benchmark_001", "pergunta": "Quantos imóveis rurais ativos existem no Mato Grosso do Sul?", "sql": "SELECT\n\tCOUNT(*) AS total_imoveis\nFROM\n\tanalise_dados.dim_imovel di\n\tJOIN analise_dados.dim_estado de ON CAST(di.cod_uf AS int4) = de.cod_uf\nWHERE\n\tdi.ind_tipo_imovel = 'IRU'\n\tAND di.ind_status_imovel = 'AT'\n\tAND de.sigla_uf = 'MS';", "dificuldade": "fácil", "categorias": [ "imovel", "geografico" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_002", "pergunta": "Quantas unidades de conservação estão cadastradas no bioma Pantanal?", "sql": "SELECT\n\tCOUNT(*) AS total_ucs\nFROM\n\tanalise_dados.dim_unidades_conservacao\nWHERE\n\tUPPER(biomaibge) = 'PANTANAL';", "dificuldade": "fácil", "categorias": [ "unidade_conservacao", "geografico" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_003", "pergunta": "Qual a classificação de tamanho mais comum dos imóveis rurais no Rio Grande do Sul?", "sql": "SELECT\n\tdi.class_tam_imovel,\n\tCOUNT(*) AS total\nFROM\n\tanalise_dados.dim_imovel di\n\tJOIN analise_dados.dim_estado de ON CAST(di.cod_uf AS int4) = de.cod_uf\nWHERE\n\tdi.ind_tipo_imovel = 'IRU'\n\tAND de.sigla_uf = 'RS'\nGROUP BY\n\tdi.class_tam_imovel\nORDER BY\n\ttotal DESC\nLIMIT\n\t1;", "dificuldade": "fácil", "categorias": [ "imovel", "geografico" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_004", "pergunta": "Quais unidades de conservação de proteção integral existem no bioma Amazônia?", "sql": "SELECT\n\tuc.nomeuc\n\t-- uc.siglacateg,\n\t-- uc.esferaadm,\n\t-- uc.areahaalb,\n\t-- uc.criacaoano\nFROM\n\tanalise_dados.dim_unidades_conservacao uc\nWHERE\n\tuc.grupouc = 'PI'\n\tAND UPPER(uc.biomaibge) = 'AMAZÔNIA'\nORDER BY\n\tuc.areahaalb DESC;", "dificuldade": "fácil", "categorias": [ "unidade_conservacao", "geografico" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_005", "pergunta": "Quais unidades de conservação (código e nome) estão localizadas no bioma Pantanal?", "sql": "SELECT\n\tcnuc,\n\tnomeuc\nFROM\n\tanalise_dados.dim_unidades_conservacao\nWHERE\n\tUPPER(biomaibge) = 'PANTANAL';", "dificuldade": "fácil", "categorias": [ "unidade_conservacao", "geografico" ], "order_matters": false, "num_column_matters": true, "num_row_matters": true }, { "id": "environmental_registry_benchmark_006", "pergunta": "Qual a quantidade de embargos em 2022?", "sql": "SELECT \n COUNT(*) AS total_embargos\nFROM dim_embargo\nWHERE TO_TIMESTAMP(dat_embarg, 'DD/MM/YY HH24:MI:SS') >= DATE '2022-01-01'\n AND TO_TIMESTAMP(dat_embarg, 'DD/MM/YY HH24:MI:SS') < DATE '2023-01-01';", "dificuldade": "fácil", "categorias": [ "terra_indigena", "geografico" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_007", "pergunta": "Qual a soma total da área de todos os imóveis rurais ativos cadastrados no CAR?", "sql": "SELECT\n\tSUM(di.area_imovel) AS area_total_ha\nFROM\n\tanalise_dados.dim_imovel di\nWHERE\n\tdi.ind_tipo_imovel = 'IRU'\n\tAND di.ind_status_imovel = 'AT';", "dificuldade": "fácil", "categorias": [ "imovel" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_008", "pergunta": "Qual a área total de unidades de conservação de proteção integral no bioma Amazônia?", "sql": "SELECT\n\tSUM(duc.areahaalb) AS area_total_ha\nFROM\n\tanalise_dados.dim_unidades_conservacao duc\nWHERE\n\tduc.grupouc = 'PI'\n\tAND duc.biomaibge = 'AMAZÔNIA';", "dificuldade": "fácil", "categorias": [ "unidade_conservacao" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_009", "pergunta": "Quantos imóveis rurais não possuem coordenadas de centroide cadastradas?", "sql": "SELECT\n\tCOUNT(*) AS total_sem_coordenadas\nFROM\n\tanalise_dados.dim_imovel\nWHERE\n\tind_tipo_imovel = 'IRU'\n\tAND (\n\t\tlat_imovel IS NULL\n\t\tOR long_imovel IS NULL\n\t);", "dificuldade": "fácil", "categorias": [ "imovel", "qualidade_dados" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_010", "pergunta": "Quantas parcelas SIGEF foram submetidas mas ainda não possuem data de aprovação preenchida?", "sql": "SELECT\n\tCOUNT(*) AS parcelas_sem_aprovacao\nFROM\n\tanalise_dados.dim_sigef\nWHERE\n\tdata_submissao IS NOT NULL\n\tAND data_aprovacao IS NULL;", "dificuldade": "fácil", "categorias": [ "sigef", "qualidade_dados" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_011", "pergunta": "Qual o percentual de imóveis rurais que não possuem módulo fiscal calculado?", "sql": "SELECT\n\tROUND(\n\t\t100.0 * COUNT(*) FILTER (\n\t\t\tWHERE\n\t\t\t\tnum_modulo_fiscal IS NULL\n\t\t) / NULLIF(COUNT(*), 0),\n\t\t2\n\t) AS percentual_sem_modulo\nFROM\n\tanalise_dados.dim_imovel\nWHERE\n\tind_tipo_imovel = 'IRU';", "dificuldade": "fácil", "categorias": [ "imovel", "qualidade_dados" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_012", "pergunta": "Quantos registros de desmatamento existem no total e quantos possuem coordenadas de latitude e longitude preenchidas? Me dê o total, com latitude e com longitude.", "sql": "SELECT\n\tCOUNT(*) AS total_registros,\n\tCOUNT(latitude_desmatamento) AS com_latitude,\n\tCOUNT(longitude_desmatamento) AS com_longitude\nFROM\n\tanalise_dados.fato_desmatamento;", "dificuldade": "fácil", "categorias": [ "desmatamento", "qualidade_dados" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_013", "pergunta": "Qual a área total da terra indígena Yanomami?", "sql": "SELECT\n\tterrai_nom,\n\tarea_ti_total\nFROM\n\tanalise_dados.dim_terra_indigena\nWHERE\n\tterrai_nom ILIKE '%Yanomami%';", "dificuldade": "fácil", "categorias": [ "terra_indigena" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_014", "pergunta": "Quantas unidades de conservação de proteção integral existem por bioma?", "sql": "SELECT\n\tbiomaibge AS bioma,\n\tCOUNT(*) AS total_ucs\nFROM\n\tanalise_dados.dim_unidades_conservacao\nWHERE\n\tgrupouc = 'PI'\nGROUP BY\n\tbiomaibge\nORDER BY\n\ttotal_ucs DESC;", "dificuldade": "fácil", "categorias": [ "unidade_conservacao" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_015", "pergunta": "Qual a área total de Reservas Extrativistas na Amazônia?", "sql": "SELECT\n\tSUM(areahaalb) AS area_total_ha\nFROM\n\tanalise_dados.dim_unidades_conservacao\nWHERE\n\tsiglacateg = 'RESEX'\n\tAND biomaibge = 'AMAZÔNIA';", "dificuldade": "fácil", "categorias": [ "unidade_conservacao" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_016", "pergunta": "Qual a área total de terras indígenas homologadas comparada com as regularizadas?", "sql": "SELECT\n\tfase_ti,\n\t-- COUNT(*) AS total_tis,\n\tSUM(area_ti_total) AS area_total_ha\nFROM\n\tanalise_dados.dim_terra_indigena\nWHERE\n\tfase_ti IN ('Homologada', 'Regularizada')\nGROUP BY\n\tfase_ti\nORDER BY\n\tarea_total_ha DESC;", "dificuldade": "fácil", "categorias": [ "terra_indigena" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_017", "pergunta": "Quantos Parques Nacionais existem por bioma e qual sua área total?", "sql": "SELECT\n\tbiomaibge AS bioma,\n\tCOUNT(*) AS total_parnas,\n\tSUM(areahaalb) AS area_total_ha\nFROM\n\tanalise_dados.dim_unidades_conservacao\nWHERE\n\tsiglacateg = 'PARNA'\nGROUP BY\n\tbiomaibge\nORDER BY\n\tarea_total_ha DESC;", "dificuldade": "fácil", "categorias": [ "unidade_conservacao" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_018", "pergunta": "Quantos imóveis rurais ativos existem na região Norte do Brasil?", "sql": "SELECT\n\tCOUNT(*) AS total_imoveis\nFROM\n\tanalise_dados.dim_imovel i\n\tJOIN analise_dados.dim_estado e ON i.cod_uf = e.cod_uf\nWHERE\n\ti.ind_tipo_imovel = 'IRU'\n\tAND i.ind_status_imovel = 'AT'\n\tAND e.sigla_uf IN ('AC', 'AM', 'AP', 'PA', 'RO', 'RR', 'TO');", "dificuldade": "fácil", "categorias": [ "imovel", "região" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_019", "pergunta": "Qual a área total de Terras Indígenas na região Sudeste?", "sql": "SELECT\n\tSUM(fa.superficie) AS area_total_ti_ha\nFROM\n\tanalise_dados.fato_area_indigena fa\nWHERE\n\tfa.uf_sigla IN ('SP', 'MG', 'RJ', 'ES');", "dificuldade": "fácil", "categorias": [ "terra_indigena", "região" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_020", "pergunta": "Qual foi o desmatamento total (em hectares) por ano no bioma Amazônia?", "sql": "SELECT\n fd.ano_desmatamento::int AS ano,\n SUM(fd.area_desmatada) AS total_desmatado_ha\nFROM analise_dados.fato_desmatamento fd\nWHERE\n fd.bioma = 'Amazônia'\n AND fd.ano_desmatamento IS NOT NULL\nGROUP BY\n fd.ano_desmatamento\nORDER BY\n ano;", "dificuldade": "fácil", "categorias": [ "temporal", "desmatamento" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_021", "pergunta": "Liste todas as unidades de conservação federais da Região Sul, ordenadas por área do maior para o menor. ", "sql": "SELECT\n uc.nomeuc,\n -- uc.siglacateg,\n -- uc.grupouc,\n uc.areahaalb\n -- uc.biomaibge\nFROM analise_dados.dim_unidades_conservacao uc\nWHERE uc.esferaadm = 'Federal'\n AND EXISTS (\n SELECT 1\n FROM analise_dados.dim_estado e\n WHERE e.sigla_uf IN ('PR', 'SC', 'RS')\n AND ST_Intersects(uc.geo_uc, e.geo_estado)\n )\nORDER BY uc.areahaalb DESC;", "dificuldade": "médio", "categorias": [ "unidade_conservacao", "geografico" ], "order_matters": true, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_022", "pergunta": "Qual o estado da Região Nordeste com maior área total desmatada?", "sql": "SELECT\n\tde.nome_uf,\n\tSUM(fd.area_desmatada) AS total_desmatado\nFROM\n\tanalise_dados.fato_desmatamento fd\n\tJOIN analise_dados.dim_imovel di ON fd.cod_imovel = di.cod_imovel\n\tJOIN analise_dados.dim_estado de ON CAST(di.cod_uf AS int4) = de.cod_uf\nWHERE\n\tde.sigla_uf IN (\n\t\t'AL',\n\t\t'BA',\n\t\t'CE',\n\t\t'MA',\n\t\t'PB',\n\t\t'PE',\n\t\t'PI',\n\t\t'RN',\n\t\t'SE'\n\t)\nGROUP BY\n\tde.nome_uf\nORDER BY\n\ttotal_desmatado DESC\nLIMIT\n\t1;", "dificuldade": "médio", "categorias": [ "desmatamento", "geografico" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_023", "pergunta": "Qual a soma de área desmatada nos estados do Centro-Oeste em 2022 em hectares?", "sql": "SELECT\n\tSUM(fd.area_desmatada) AS total_desmatado_ha\nFROM\n\tanalise_dados.fato_desmatamento fd\n\tJOIN analise_dados.dim_imovel di ON fd.cod_imovel = di.cod_imovel\n\tJOIN analise_dados.dim_estado de ON CAST(di.cod_uf AS int4) = de.cod_uf\nWHERE\n\tde.sigla_uf IN ('DF', 'GO', 'MS', 'MT')\n\tAND fd.ano_desmatamento = 2022;", "dificuldade": "médio", "categorias": [ "desmatamento", "geografico" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_024", "pergunta": "Quais são os municípios do Maranhão com desmatamento registrado no bioma Cerrado?", "sql": "SELECT DISTINCT\n\tdm.mun_nome\nFROM\n\tanalise_dados.fato_desmatamento fd\n\tJOIN analise_dados.dim_imovel di ON fd.cod_imovel = di.cod_imovel\n\tJOIN analise_dados.dim_municipio dm ON di.cod_mun = CAST(dm.cod_mun AS int4)\n\tJOIN analise_dados.dim_estado de ON CAST(di.cod_uf AS int4) = de.cod_uf\nWHERE\n\tde.sigla_uf = 'MA'\n\tAND UPPER(fd.bioma) = 'CERRADO'\nORDER BY\n\tdm.mun_nome;", "dificuldade": "médio", "categorias": [ "desmatamento", "geografico" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_025", "pergunta": "Qual a área média em hectares dos imóveis rurais por estado da Região Nordeste?", "sql": "SELECT\n\tde.nome_uf,\n\t-- de.sigla_uf,\n\tAVG(di.area_imovel) AS area_media_ha\n\t-- COUNT(*) AS total_imoveis\nFROM\n\tanalise_dados.dim_imovel di\n\tJOIN analise_dados.dim_estado de ON CAST(di.cod_uf AS int4) = de.cod_uf\nWHERE\n\tdi.ind_tipo_imovel = 'IRU'\n\tAND de.sigla_uf IN (\n\t\t'AL',\n\t\t'BA',\n\t\t'CE',\n\t\t'MA',\n\t\t'PB',\n\t\t'PE',\n\t\t'PI',\n\t\t'RN',\n\t\t'SE'\n\t)\nGROUP BY\n\tde.nome_uf,\n\tde.sigla_uf\nORDER BY\n\tarea_media_ha DESC;", "dificuldade": "médio", "categorias": [ "imovel", "geografico" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_026", "pergunta": "Quais são os 10 municípios do Mato Grosso com maior área desmatada acumulada em hectares?", "sql": "SELECT\n\tdm.mun_nome,\n\tSUM(fd.area_desmatada) AS area_desmatada_total_ha\nFROM\n\tanalise_dados.fato_desmatamento fd\n\tJOIN analise_dados.dim_imovel di ON fd.cod_imovel = di.cod_imovel\n\tJOIN analise_dados.dim_municipio dm ON di.cod_mun = CAST(dm.cod_mun AS int4)\n\tJOIN analise_dados.dim_estado de ON CAST(di.cod_uf AS int4) = de.cod_uf\nWHERE\n\tde.sigla_uf = 'MT'\nGROUP BY\n\tdm.mun_nome\nORDER BY\n\tarea_desmatada_total_ha DESC\nLIMIT\n\t10;", "dificuldade": "médio", "categorias": [ "desmatamento", "geografico" ], "order_matters": true, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_027", "pergunta": "Qual a evolução anual do desmatamento no bioma Cerrado nos estados do Centro-Oeste? Dê a área desmatada em hectáres por ano para cada estado.", "sql": "SELECT\n\tfd.ano_desmatamento,\n\tde.sigla_uf,\n\tSUM(fd.area_desmatada) AS area_desmatada_ha\nFROM\n\tanalise_dados.fato_desmatamento fd\n\tJOIN analise_dados.dim_imovel di ON fd.cod_imovel = di.cod_imovel\n\tJOIN analise_dados.dim_estado de ON CAST(di.cod_uf AS int4) = de.cod_uf\nWHERE\n\tde.sigla_uf IN ('DF', 'GO', 'MS', 'MT')\n\tAND UPPER(fd.bioma) = 'CERRADO'\nGROUP BY\n\tfd.ano_desmatamento,\n\tde.sigla_uf\nORDER BY\n\tfd.ano_desmatamento,\n\tde.sigla_uf;", "dificuldade": "médio", "categorias": [ "desmatamento", "geografico", "temporal" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_028", "pergunta": "Compare a área total de unidades de conservação de uso sustentável vs. proteção integral no bioma Mata Atlântica, agrupado por esfera administrativa. Me dê a esferaadm, o nome do grupo (Proteção Integral, Uso Sustentável) e a área total.", "sql": "SELECT\n\tuc.esferaadm,\n\t-- uc.grupouc,\n\tCASE\n\t\tWHEN uc.grupouc = 'PI' THEN 'Proteção Integral'\n\t\tELSE 'Uso Sustentável'\n\tEND AS grupo_descricao,\n\t-- COUNT(*) AS total_ucs,\n\tSUM(uc.areahaalb) AS area_total_ha\nFROM\n\tanalise_dados.dim_unidades_conservacao uc\nWHERE\n\tUPPER(uc.biomaibge) = 'MATA ATLÂNTICA'\nGROUP BY\n\tuc.esferaadm,\n\tuc.grupouc\nORDER BY\n\tuc.esferaadm,\n\tuc.grupouc;", "dificuldade": "médio", "categorias": [ "unidade_conservacao", "geografico" ], "order_matters": false, "num_column_matters": true, "num_row_matters": true }, { "id": "environmental_registry_benchmark_029", "pergunta": "Calcule a área geográfica real em km2 de cada estado do Nordeste usando a sua geometria espacial. Me dê a sigla, nome e área.", "sql": "SELECT\n sigla_uf,\n nome_uf,\n ROUND((ST_Area(geo_estado) / 1000000)::numeric, 2) AS area_km2\nFROM dim_estado\nWHERE sigla_uf IN ('AL', 'BA', 'CE', 'MA', 'PB', 'PE', 'PI', 'RN', 'SE')\nORDER BY sigla_uf;", "dificuldade": "médio", "categorias": [ "geoespacial", "geografico" ], "order_matters": false, "num_column_matters": true, "num_row_matters": true }, { "id": "environmental_registry_benchmark_030", "pergunta": "Qual a área média em ha dos CARs classificados como Grande no estado de minas?", "sql": "SELECT\n\tAVG(i.area_imovel) AS area_media_hectares\nFROM\n\tdim_imovel i\n\tINNER JOIN dim_estado e ON i.cod_uf = e.cod_uf\nWHERE\n\te.cod_uf = 31\n\tAND i.class_tam_imovel = 'Grande'", "dificuldade": "médio", "categorias": [ "imovel" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_031", "pergunta": "Quais são os 10 municípios com maior número de imóveis rurais cadastrados?", "sql": "SELECT \n m.mun_nome AS municipio,\n COUNT(*) AS numero_imoveis\nFROM analise_dados.dim_imovel i\nINNER JOIN analise_dados.dim_municipio m ON i.cod_mun = m.cod_mun\nWHERE i.ind_tipo_imovel = 'IRU'\nGROUP BY m.mun_nome\nORDER BY numero_imoveis DESC\nLIMIT 10", "dificuldade": "médio", "categorias": [ "imovel" ], "order_matters": true, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_032", "pergunta": "Qual o bioma com maior área desmatada acumulada nos últimos 5 anos (2019 a 2023)?", "sql": "SELECT\n fd.bioma,\n SUM(fd.area_desmatada) AS area_total_desmatada_ha\nFROM\n analise_dados.fato_desmatamento fd\nWHERE\n fd.ano_desmatamento >= 2019\n AND fd.ano_desmatamento <= 2023\nGROUP BY\n fd.bioma\nORDER BY\n area_total_desmatada_ha DESC\nLIMIT\n 1;", "dificuldade": "médio", "categorias": [ "desmatamento", "temporal" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_033", "pergunta": "Quantos eventos de desmatamento foram registrados por ano nos imóveis rurais?", "sql": "SELECT\n fd.ano_desmatamento,\n COUNT(*) AS total_eventos\nFROM\n analise_dados.fato_desmatamento fd\n INNER JOIN analise_dados.dim_imovel di ON fd.cod_imovel = di.cod_imovel\nWHERE\n di.ind_tipo_imovel = 'IRU'\nGROUP BY\n fd.ano_desmatamento\nORDER BY\n fd.ano_desmatamento;", "dificuldade": "médio", "categorias": [ "desmatamento", "temporal" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_034", "pergunta": "Qual a distribuição dos índices de similaridade Jaccard entre parcelas SIGEF e imóveis CAR por faixa percentual no Sul do Brasil? Eu quero a faixa percentual, o totals de pares e o jaccard médio.", "sql": "SELECT\n fss.faixa_percent_similaridade AS faixa_percentual,\n COUNT(*) AS total_pares,\n ROUND(AVG(fss.indice_jaccard), 4) AS jaccard_medio\nFROM fato_similaridade_sigef fss\nJOIN dim_imovel di ON fss.cod_imovel = di.cod_imovel\nJOIN dim_estado de ON di.cod_uf = de.cod_uf\nWHERE de.sigla_uf IN ('PR', 'SC', 'RS')\nGROUP BY fss.faixa_percent_similaridade\nORDER BY\n CASE fss.faixa_percent_similaridade\n WHEN '0-25%' THEN 1\n WHEN '25-50%' THEN 2\n WHEN '50-75%' THEN 3\n WHEN '75-100%' THEN 4\n END;", "dificuldade": "médio", "categorias": [ "sigef" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_035", "pergunta": "Quais são os 10 municípios (nome e área) com maior área total de imóveis rurais cadastrados? Maior para menor.", "sql": "SELECT\n dm.mun_nome,\n SUM(di.area_imovel) AS area_total_ha\nFROM\n analise_dados.dim_imovel di\n JOIN analise_dados.dim_municipio dm ON di.cod_mun = CAST(dm.cod_mun AS int4)\nWHERE\n di.ind_tipo_imovel = 'IRU'\nGROUP BY\n dm.mun_nome\nORDER BY\n area_total_ha DESC\nLIMIT\n 10;", "dificuldade": "médio", "categorias": [ "imovel" ], "order_matters": true, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_036", "pergunta": "Quantos embargos ambientais foram registrados por motivo de desmatamento ou queimada no ano de 2022?", "sql": "SELECT\n COUNT(id_embargo) AS total_embargos\nFROM\n analise_dados.dim_embargo\nWHERE\n sit_desmat = 'D'\n AND EXTRACT(\n YEAR\n FROM\n TO_DATE (dat_embarg, 'DD/MM/YY HH24:MI:SS')\n ) = 2022;", "dificuldade": "médio", "categorias": [ "embargo", "temporal" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_037", "pergunta": "Determine a proporção de imóveis rurais classificados como Médios ou Grandes (via CAR) que possuem índice de similaridade de Jaccard no SIGEF entre 0.9 e 1.0.", "sql": "WITH total_imoveis AS (\n SELECT COUNT(DISTINCT cod_imovel) as total_médio_grande\n FROM analise_dados.dim_imovel\n WHERE ind_tipo_imovel = 'IRU'\n AND class_tam_imovel IN ('Médio', 'Grande')\n),\nimoveis_com_alta_similaridade AS (\n SELECT COUNT(DISTINCT fs.cod_imovel) as com_alta_similaridade\n FROM analise_dados.fato_similaridade_sigef fs\n INNER JOIN analise_dados.dim_imovel di ON fs.cod_imovel = di.cod_imovel\n WHERE di.ind_tipo_imovel = 'IRU'\n AND di.class_tam_imovel IN ('Médio', 'Grande')\n AND fs.indice_jaccard BETWEEN 0.9 AND 1.0\n)\nSELECT \n -- t.total_médio_grande,\n -- i.com_alta_similaridade,\n CASE \n WHEN t.total_médio_grande > 0 \n THEN ROUND((i.com_alta_similaridade::numeric / t.total_médio_grande) * 100, 2)\n ELSE 0\n END as proporcao_percentual\nFROM total_imoveis t\nCROSS JOIN imoveis_com_alta_similaridade i", "dificuldade": "médio", "categorias": [ "imovel", "sigef" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_038", "pergunta": "Qual a proporção de parcelas SIGEF que possuem matrícula registrada versus as que não possuem, por status? Dê os valores absolutos e porcentuais dos dados para melhor visualização.", "sql": "SELECT \n status,\n COUNT(*) AS total_parcelas,\n SUM(CASE WHEN registro_matricula = TRUE THEN 1 ELSE 0 END) AS com_matricula,\n SUM(CASE WHEN registro_matricula = FALSE THEN 1 ELSE 0 END) AS sem_matricula,\n ROUND(100.0 * SUM(CASE WHEN registro_matricula = TRUE THEN 1 ELSE 0 END) / COUNT(*), 2) AS proporcao_com_matricula_pct,\n ROUND(100.0 * SUM(CASE WHEN registro_matricula = FALSE THEN 1 ELSE 0 END) / COUNT(*), 2) AS proporcao_sem_matricula_pct\nFROM dim_sigef\nGROUP BY status\nORDER BY status;", "dificuldade": "médio", "categorias": [ "sigef", "qualidade_dados" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_039", "pergunta": "Por estado, quantos imóveis rurais possuem geometria e quantos não possuem? Mostre o percentual de completude.", "sql": "SELECT\n de.sigla_uf,\n COUNT(*) AS total_imoveis,\n COUNT(di.geo_imovel) AS com_geometria,\n COUNT(*) - COUNT(di.geo_imovel) AS sem_geometria,\n ROUND(\n 100.0 * COUNT(di.geo_imovel) / NULLIF(COUNT(*), 0),\n 2\n ) AS percentual_completude\nFROM\n analise_dados.dim_imovel di\n JOIN analise_dados.dim_estado de ON CAST(di.cod_uf AS int4) = de.cod_uf\nWHERE\n di.ind_tipo_imovel = 'IRU'\nGROUP BY\n de.sigla_uf\nORDER BY\n percentual_completude ASC;", "dificuldade": "médio", "categorias": [ "imovel", "qualidade_dados" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_040", "pergunta": "Qual a área total em hectares das unidades de conservação por esfera administrativa, ignorando aquelas que não possuem área oficial preenchida?", "sql": "SELECT\n esferaadm,\n SUM(areahaalb) AS area_total_ha\nFROM\n analise_dados.dim_unidades_conservacao\nWHERE\n areahaalb IS NOT NULL\nGROUP BY\n esferaadm;", "dificuldade": "médio", "categorias": [ "unidade_conservacao", "qualidade_dados" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_041", "pergunta": "Quais as 10 terras indígenas com o maior número de CARs distintos sobrepostos? Maior para menor.", "sql": "SELECT\n -- ti.terrai_cod,\n ti.terrai_nom AS nome_terra_indigena,\n COUNT(DISTINCT f.cod_imovel) AS numero_imoveis_sobrepostos\nFROM fato_sobreposicao_terra_indigena f\nJOIN dim_terra_indigena ti\n ON f.terrai_cod = ti.terrai_cod\nGROUP BY\n ti.terrai_cod,\n ti.terrai_nom\nORDER BY\n numero_imoveis_sobrepostos DESC,\n ti.terrai_nom ASC\nLIMIT 10;\n", "dificuldade": "médio", "categorias": [ "terra_indigena", "sobreposicao" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_042", "pergunta": "Qual o ranking dos 10 imóveis com o maior número de embargos distintos associados?", "sql": "SELECT fse.cod_imovel,\n COUNT(DISTINCT fse.id_embargo) AS total_embargos\nFROM analise_dados.fato_sobreposicao_embargo fse\nGROUP BY fse.cod_imovel\nORDER BY total_embargos DESC\nLIMIT 10;", "dificuldade": "médio", "categorias": [ "embargo", "sobreposicao" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_043", "pergunta": "Qual a distribuição de assentamentos por região do Brasil? Coloque os assentamentos sem região em duas categorias: Código de UF inválido e UF não informada", "sql": "WITH\n regiao_map AS (\n SELECT\n sigla_uf,\n CASE\n WHEN sigla_uf IN ('AC', 'AP', 'AM', 'PA', 'RO', 'RR', 'TO') THEN 'Norte'\n WHEN sigla_uf IN (\n 'AL',\n 'BA',\n 'CE',\n 'MA',\n 'PB',\n 'PE',\n 'PI',\n 'RN',\n 'SE'\n ) THEN 'Nordeste'\n WHEN sigla_uf IN ('DF', 'GO', 'MT', 'MS') THEN 'Centro-Oeste'\n WHEN sigla_uf IN ('ES', 'MG', 'RJ', 'SP') THEN 'Sudeste'\n WHEN sigla_uf IN ('PR', 'RS', 'SC') THEN 'Sul'\n END AS regiao\n FROM\n dim_estado\n )\nSELECT\n COALESCE(\n r.regiao,\n CASE\n WHEN a.uf IS NULL THEN 'UF não informada'\n ELSE 'Código de UF inválido'\n END\n ) AS regiao,\n COUNT(*) AS total_assentamentos\nFROM\n dim_assentamento a\n LEFT JOIN regiao_map r ON UPPER(a.uf) = r.sigla_uf\nGROUP BY\n COALESCE(\n r.regiao,\n CASE\n WHEN a.uf IS NULL THEN 'UF não informada'\n ELSE 'Código de UF inválido'\n END\n )\nORDER BY\n total_assentamentos DESC;", "dificuldade": "médio", "categorias": [ "assentamento", "região" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_044", "pergunta": "Qual a gleba federal com mais imóveis rurais sobrepostos?", "sql": "SELECT\n tu.nome_gleba,\n -- tu.area_tu,\n COUNT(DISTINCT ft.cod_imovel) AS total_imoveis\nFROM\n analise_dados.fato_imovel_terra_uniao ft\n JOIN analise_dados.dim_terra_uniao tu ON ft.id_tu = tu.id_tu\n JOIN analise_dados.dim_imovel i ON ft.cod_imovel = i.cod_imovel\nWHERE\n i.ind_tipo_imovel = 'IRU'\nGROUP BY\n tu.nome_gleba,\n tu.area_tu\nORDER BY\n total_imoveis DESC\nLIMIT\n 1;", "dificuldade": "médio", "categorias": [ "terra_uniao", "sobreposição" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_045", "pergunta": "Quais as 10 unidades de conservação de proteção integral com o maior número de imóveis sobrepostos?", "sql": "SELECT\n duc.nomeuc,\n -- duc.siglacateg,\n COUNT(DISTINCT fsuc.cod_imovel) AS total_imoveis_sobrepostos\nFROM\n analise_dados.fato_sobreposicao_unidades_conservacao fsuc\n JOIN analise_dados.dim_unidades_conservacao duc ON fsuc.cnuc = duc.cnuc\nWHERE\n duc.grupouc = 'PI'\nGROUP BY\n duc.nomeuc,\n duc.siglacateg\nORDER BY\n total_imoveis_sobrepostos DESC\nLIMIT\n 10;", "dificuldade": "médio", "categorias": [ "unidade_conservacao", "sobreposicao" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_046", "pergunta": "Quantos imóveis rurais ativos existem em cada estado, mostrando o nome completo do estado? Do maior para menor", "sql": "SELECT\n de.nome_uf,\n COUNT(di.cod_imovel) AS total_imoveis\nFROM\n analise_dados.dim_imovel di\n JOIN analise_dados.dim_estado de ON CAST(di.cod_uf AS int4) = de.cod_uf\nWHERE\n di.ind_tipo_imovel = 'IRU'\n AND di.ind_status_imovel = 'AT'\nGROUP BY\n de.nome_uf\nORDER BY\n total_imoveis DESC;", "dificuldade": "médio", "categorias": [ "imovel" ], "order_matters": true, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_047", "pergunta": "Qual a área total desmatada por ano, considerando apenas imóveis rurais no bioma Cerrado?", "sql": "SELECT \n CAST(fd.ano_desmatamento AS INTEGER) as ano,\n SUM(fd.area_desmatada) as area_total_desmatada_hectares\nFROM analise_dados.fato_desmatamento fd\nINNER JOIN analise_dados.dim_imovel di ON fd.cod_imovel = di.cod_imovel\nWHERE fd.bioma = 'Cerrado'\n AND di.ind_tipo_imovel = 'IRU'\nGROUP BY fd.ano_desmatamento\nORDER BY ano;", "dificuldade": "médio", "categorias": [ "desmatamento", "temporal" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_048", "pergunta": "Quantos embargos por desmatamento estão sobrepostos a imóveis rurais grandes, e qual a área total de sobreposição?", "sql": "SELECT\n COUNT(DISTINCT fse.id_embargo) AS qtd_embargos,\n SUM(fse.area_embar_car) AS area_total_sobreposicao\nFROM\n fato_sobreposicao_embargo fse\n JOIN dim_embargo de ON fse.id_embargo = de.id_embargo\n JOIN dim_imovel di ON fse.cod_imovel = di.cod_imovel\nWHERE\n de.sit_desmat = 'D'\n AND di.class_tam_imovel = 'Grande'\n AND di.ind_tipo_imovel = 'IRU'", "dificuldade": "médio", "categorias": [ "embargo", "sobreposicao", "imovel" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_049", "pergunta": "Quantas parcelas SIGEF vinculadas a CARs foram aprovadas em 2023, agrupadas por natureza e status e agrupados pelos mesmos na mesma ordem?", "sql": "SELECT\n ds.natureza,\n ds.status,\n COUNT(DISTINCT ds.parcela_codigo) AS qtd_parcelas\nFROM fato_similaridade_sigef fss\nJOIN dim_sigef ds\n ON fss.parcela_codigo = ds.parcela_codigo\nWHERE ds.data_aprovacao >= '2023/01/01'\n AND ds.data_aprovacao < '2024/01/01'\nGROUP BY ds.natureza, ds.status\nORDER BY ds.natureza, ds.status;", "dificuldade": "médio", "categorias": [ "sigef", "temporal" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_050", "pergunta": "Compare o número de imóveis rurais com desmatamento em 2024 e a soma da área desmatada, agrupados por UF.\n\n", "sql": "SELECT\n de.sigla_uf,\n COUNT(DISTINCT fd.cod_imovel) AS total_imoveis,\n SUM(fd.area_desmatada) AS soma_area_desmatada_ha\nFROM\n analise_dados.fato_desmatamento fd\n JOIN analise_dados.dim_imovel di\n ON fd.cod_imovel = di.cod_imovel\n JOIN analise_dados.dim_estado de\n ON di.cod_uf = de.cod_uf\nWHERE\n di.ind_tipo_imovel = 'IRU'\n AND fd.ano_desmatamento = 2024\nGROUP BY\n de.sigla_uf\nORDER BY\n de.sigla_uf;\n", "dificuldade": "médio", "categorias": [ "embargo", "sobreposicao" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_051", "pergunta": "Qual a área total desmatada em Novo Progresso nos últimos 5 anos registrados?", "sql": "WITH\n ultimos_anos AS (\n SELECT DISTINCT\n ano_desmatamento\n FROM\n analise_dados.fato_desmatamento\n ORDER BY\n ano_desmatamento DESC\n LIMIT\n 5\n )\nSELECT\n -- dm.mun_nome,\n SUM(fd.area_desmatada) AS total_desmatado_ha\nFROM\n analise_dados.fato_desmatamento fd\n JOIN analise_dados.dim_imovel di ON fd.cod_imovel = di.cod_imovel\n JOIN analise_dados.dim_municipio dm ON di.cod_mun = CAST(dm.cod_mun AS int4)\nWHERE\n LOWER(dm.mun_nome) = 'novo progresso'\n AND fd.ano_desmatamento IN (\n SELECT\n ano_desmatamento\n FROM\n ultimos_anos\n )\nGROUP BY\n dm.mun_nome;", "dificuldade": "difícil", "categorias": [ "desmatamento", "geografico", "temporal" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_052", "pergunta": "Quantos imóveis rurais grandes existem em cada estado da Região Norte, e qual o percentual em relação ao total de imóveis do estado? Me dê o nome do estado, o total de imóvies e o total e a porcentagem de grandes.", "sql": "WITH\n imoveis_norte AS (\n SELECT\n de.sigla_uf,\n de.nome_uf,\n COUNT(*) AS total_imoveis,\n COUNT(*) FILTER (\n WHERE\n di.class_tam_imovel = 'Grande'\n ) AS grandes\n FROM\n analise_dados.dim_imovel di\n JOIN analise_dados.dim_estado de ON CAST(di.cod_uf AS int4) = de.cod_uf\n WHERE\n di.ind_tipo_imovel = 'IRU'\n AND de.sigla_uf IN ('AC', 'AM', 'AP', 'PA', 'RO', 'RR', 'TO')\n GROUP BY\n de.sigla_uf,\n de.nome_uf\n )\nSELECT\n nome_uf,\n -- sigla_uf,\n total_imoveis,\n grandes,\n ROUND(100.0 * grandes / NULLIF(total_imoveis, 0), 2) AS percent_grandes\nFROM\n imoveis_norte\nORDER BY\n percent_grandes DESC;", "dificuldade": "difícil", "categorias": [ "imovel", "geografico" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_053", "pergunta": "Quais imóveis rurais ativos possuem sobreposição com terra indígena, mas não com embargo, e cujo percentual de sobreposição com TI é superior a 75%? Me dê o código do imóvel, área do imóvel, porcetangem de sobreposição e nome da TI", "sql": "SELECT\n di.cod_imovel,\n di.area_imovel,\n fsti.percent_car_ti,\n dti.terrai_nom\nFROM\n analise_dados.dim_imovel di\n INNER JOIN analise_dados.fato_sobreposicao_terra_indigena fsti ON di.cod_imovel = fsti.cod_imovel\n INNER JOIN analise_dados.dim_terra_indigena dti ON fsti.terrai_cod = dti.terrai_cod\nWHERE\n di.ind_tipo_imovel = 'IRU'\n AND di.ind_status_imovel = 'AT'\n AND fsti.faixa_percent_sobrep = '75-100%'\n AND NOT EXISTS (\n SELECT\n 1\n FROM\n analise_dados.fato_sobreposicao_embargo fse\n WHERE\n fse.cod_imovel = di.cod_imovel\n )\nORDER BY\n fsti.percent_car_ti DESC;", "dificuldade": "difícil", "categorias": [ "imovel", "terra_indigena", "embargo", "sobreposicao" ], "order_matters": false, "num_column_matters": true, "num_row_matters": true }, { "id": "environmental_registry_benchmark_054", "pergunta": "Qual o percentual de imóveis rurais ativos por classificação de tamanho em cada estado? Me dê a sigla do estado, a classe, a quantidade de imóveis e o percentual.", "sql": "SELECT\n de.sigla_uf,\n di.class_tam_imovel,\n COUNT(*) AS total,\n ROUND(\n COUNT(*) * 100.0 / SUM(COUNT(*)) OVER (\n PARTITION BY\n de.sigla_uf\n ),\n 2\n ) AS percentual\nFROM\n analise_dados.dim_imovel di\n INNER JOIN analise_dados.dim_estado de ON CAST(di.cod_uf AS int4) = de.cod_uf\nWHERE\n di.ind_tipo_imovel = 'IRU'\n AND di.ind_status_imovel = 'AT'\nGROUP BY\n de.sigla_uf,\n di.class_tam_imovel\nORDER BY\n de.sigla_uf,\n percentual DESC;", "dificuldade": "difícil", "categorias": [ "imovel" ], "order_matters": false, "num_column_matters": true, "num_row_matters": true }, { "id": "environmental_registry_benchmark_055", "pergunta": "Quais são os imóveis rurais que tiveram desmatamento em 2023 no bioma Cerrado e também possuem sobreposição com embargos?", "sql": "SELECT di.cod_imovel\nFROM analise_dados.dim_imovel di\nWHERE di.ind_tipo_imovel = 'IRU'\n AND EXISTS (\n SELECT 1\n FROM analise_dados.fato_desmatamento fd\n WHERE fd.cod_imovel = di.cod_imovel\n AND fd.ano_desmatamento = 2023.0\n AND UPPER(fd.bioma) = 'CERRADO'\n )\n AND EXISTS (\n SELECT 1\n FROM analise_dados.fato_sobreposicao_embargo fse\n WHERE fse.cod_imovel = di.cod_imovel\n )\nORDER BY di.cod_imovel;\n", "dificuldade": "difícil", "categorias": [ "desmatamento", "embargo", "sobreposicao" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_056", "pergunta": "Qual o ranking dos municípios com maior área desmatada acumulada em imóveis rurais? Me dê o TOP 20 ordenado por ranking (ranking é uma coluna com 1, 2, 3...)", "sql": "WITH desmat_mun AS (\n SELECT di.cod_mun, SUM(fd.area_desmatada) AS area_desmatada_total_ha\n FROM analise_dados.fato_desmatamento fd\n INNER JOIN analise_dados.dim_imovel di ON fd.cod_imovel = di.cod_imovel\n WHERE di.ind_tipo_imovel = 'IRU'\n GROUP BY di.cod_mun\n)\nSELECT dm.mun_nome, d.area_desmatada_total_ha,\n RANK() OVER (ORDER BY d.area_desmatada_total_ha DESC) AS ranking\nFROM desmat_mun d\nINNER JOIN analise_dados.dim_municipio dm ON d.cod_mun = CAST(dm.cod_mun AS int4)\nORDER BY ranking\nLIMIT 20;", "dificuldade": "difícil", "categorias": [ "desmatamento", "imovel" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_057", "pergunta": "Qual o percentual médio de sobreposição de Terras Indígenas nos imóveis rurais que possuem embargo por desmatamento?", "sql": "WITH imoveis_com_embargo_desmat AS (\n SELECT DISTINCT fse.cod_imovel\n FROM analise_dados.fato_sobreposicao_embargo fse\n JOIN analise_dados.dim_embargo de ON de.id_embargo = fse.id_embargo\n WHERE de.sit_desmat = 'D'\n),\npercentual_por_imovel AS (\n SELECT \n iced.cod_imovel,\n COALESCE(SUM(fsti.area_ti_car), 0) / di.area_imovel * 100 AS pct_sobreposicao_ti\n FROM imoveis_com_embargo_desmat iced\n JOIN analise_dados.dim_imovel di \n ON di.cod_imovel = iced.cod_imovel\n AND di.ind_tipo_imovel = 'IRU'\n AND di.area_imovel > 0\n LEFT JOIN analise_dados.fato_sobreposicao_terra_indigena fsti \n ON fsti.cod_imovel = iced.cod_imovel\n GROUP BY iced.cod_imovel, di.area_imovel\n)\nSELECT \n ROUND(AVG(pct_sobreposicao_ti), 4) AS pct_medio_sobreposicao_ti\nFROM percentual_por_imovel;", "dificuldade": "difícil", "categorias": [ "sobreposicao", "terra_indigena", "embargo" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_058", "pergunta": "Para o município de Altamira, calcule em hectares a soma da área dos imóveis rurais do CAR e a soma da área das parcelas do SIGEF que intersectam o município, considerando somente a porção da parcela dentro do limite municipal. Retorne o resultado em uma única linha, com uma coluna para `total_car_ha` e outra para `total_sigef_ha`.", "sql": "WITH altamira AS (\n SELECT geo_mun\n FROM analise_dados.dim_municipio\n WHERE cod_mun = 1500602\n),\ncar AS (\n SELECT\n SUM(di.area_imovel) AS total_car_ha\n FROM analise_dados.dim_imovel di\n WHERE di.cod_mun = 1500602\n AND di.ind_tipo_imovel = 'IRU'\n),\nsigef AS (\n SELECT\n SUM(\n ST_Area(\n ST_Intersection(ds.geo_parcela, a.geo_mun)\n ) / 10000.0\n ) AS total_sigef_ha\n FROM analise_dados.dim_sigef ds\n CROSS JOIN altamira a\n WHERE ST_Intersects(ds.geo_parcela, a.geo_mun)\n)\nSELECT\n car.total_car_ha,\n sigef.total_sigef_ha\nFROM car\nCROSS JOIN sigef;", "dificuldade": "difícil", "categorias": [ "imovel", "sigef" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_059", "pergunta": "Entre as parcelas SIGEF registradas e matriculadas que intersectam imóveis rurais (IRU), qual é a diferença percentual entre a soma da área registrada no SIGEF e a soma da área de interseção com esses imóveis? Retorne a área SIGEF registrada total, a área de interseção total, a diferença absoluta e a diferença percentual, em hectares.", "sql": "WITH parcelas_base AS (\n SELECT DISTINCT\n s.parcela_codigo,\n s.area_hectares\n FROM analise_dados.dim_sigef s\n JOIN analise_dados.fato_similaridade_sigef f\n ON f.parcela_codigo = s.parcela_codigo\n JOIN analise_dados.dim_imovel i\n ON i.cod_imovel = f.cod_imovel\n WHERE s.status = 'REGISTRADA'\n AND s.registro_matricula = TRUE\n AND i.ind_tipo_imovel = 'IRU'\n),\narea_sigef_total AS (\n SELECT\n SUM(area_hectares) AS area_sigef_registrada\n FROM parcelas_base\n),\narea_intersecao_total AS (\n SELECT\n SUM(f.area_sigef_car) AS area_intersecao\n FROM analise_dados.fato_similaridade_sigef f\n JOIN analise_dados.dim_sigef s\n ON s.parcela_codigo = f.parcela_codigo\n JOIN analise_dados.dim_imovel i\n ON i.cod_imovel = f.cod_imovel\n WHERE s.status = 'REGISTRADA'\n AND s.registro_matricula = TRUE\n AND i.ind_tipo_imovel = 'IRU'\n)\nSELECT\n ast.area_sigef_registrada,\n ait.area_intersecao,\n ABS(ast.area_sigef_registrada - ait.area_intersecao) AS diferenca_absoluta,\n ROUND(\n (\n ABS(ast.area_sigef_registrada - ait.area_intersecao)\n / NULLIF(ast.area_sigef_registrada, 0) * 100\n )::numeric,\n 2\n ) AS diferenca_percentual\nFROM area_sigef_total ast\nCROSS JOIN area_intersecao_total ait;", "dificuldade": "difícil", "categorias": [ "sigef", "sobreposicao" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_060", "pergunta": "Qual a taxa de ocupação de assentamentos (famílias/capacidade) por região? Use outros para assentamentos que estão sem região no BD.", "sql": "SELECT\n regiao,\n -- SUM(capacidade) AS capacidade_total,\n -- SUM(num_famili) AS familias_total,\n CASE\n WHEN SUM(capacidade) = 0 THEN NULL\n ELSE ROUND(SUM(num_famili)::numeric / SUM(capacidade) * 100, 2)\n END AS taxa_ocupacao_pct\n -- COUNT(*) AS qtd_assentamentos\nFROM (\n SELECT\n cd_sipra,\n uf,\n capacidade,\n num_famili,\n CASE\n WHEN uf IN ('AC','AM','AP','PA','RO','RR','TO') THEN 'Norte'\n WHEN uf IN ('AL','BA','CE','MA','PB','PE','PI','RN','SE') THEN 'Nordeste'\n WHEN uf IN ('DF','GO','MT','MS') THEN 'Centro-Oeste'\n WHEN uf IN ('ES','MG','RJ','SP') THEN 'Sudeste'\n WHEN uf IN ('PR','RS','SC') THEN 'Sul'\n ELSE 'Outros'\n END AS regiao\n FROM dim_assentamento\n) AS mapped\nGROUP BY regiao\nORDER BY taxa_ocupacao_pct DESC NULLS LAST;", "dificuldade": "difícil", "categorias": [ "assentamento", "região" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_061", "pergunta": "Ranqueie os estados pela área em hectares total de desmatamento acumulado entre 2015 e 2023, mostrando também o percentual que cada estado representa no total nacional. Ordene pelo ranking", "sql": "WITH desmatamento_estado AS (\n SELECT\n e.sigla_uf,\n e.nome_uf,\n SUM(d.area_desmatada) AS area_total_ha\n FROM analise_dados.fato_desmatamento d\n JOIN analise_dados.dim_imovel i ON d.cod_imovel = i.cod_imovel\n JOIN analise_dados.dim_estado e ON i.cod_uf = e.cod_uf\n WHERE d.ano_desmatamento >= 2015\n AND d.ano_desmatamento <= 2023\n GROUP BY e.sigla_uf, e.nome_uf\n),\ntotal_nacional AS (\n SELECT SUM(area_total_ha) AS total_geral FROM desmatamento_estado\n)\nSELECT\n ROW_NUMBER() OVER (ORDER BY de.area_total_ha DESC) AS ranking,\n -- de.sigla_uf,\n de.nome_uf,\n ROUND(de.area_total_ha, 2)::NUMERIC(20,2) AS area_desmatada_ha,\n ROUND(100.0 * de.area_total_ha / tn.total_geral, 2) AS percentual_do_total\nFROM desmatamento_estado de\nCROSS JOIN total_nacional tn\nORDER BY ranking;", "dificuldade": "difícil", "categorias": [ "desmatamento", "imovel" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_062", "pergunta": "Calcule a evolução anual do desmatamento no bioma Cerrado, incluindo a variação percentual em relação ao ano anterior.", "sql": "WITH desmat_anual AS (\n SELECT\n CAST(fd.ano_desmatamento AS int) AS ano,\n SUM(fd.area_desmatada) AS area_total\n FROM analise_dados.fato_desmatamento fd\n WHERE fd.bioma = 'Cerrado'\n GROUP BY CAST(fd.ano_desmatamento AS int)\n)\nSELECT\n ano,\n area_total,\n LAG(area_total) OVER (ORDER BY ano) AS area_ano_anterior,\n ROUND(\n (area_total - LAG(area_total) OVER (ORDER BY ano)) * 100.0\n / NULLIF(LAG(area_total) OVER (ORDER BY ano), 0), 2\n ) AS variacao_percentual\nFROM desmat_anual\nORDER BY ano;", "dificuldade": "difícil", "categorias": [ "desmatamento", "temporal" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_063", "pergunta": "Para cada bioma presente na tabela de desmatamento, considere apenas os imóveis rurais que possuem ao menos um registro em fato_desmatamento. Some a área desmatada de cada imóvel dentro de cada bioma, calcule o desmatamento médio por imóvel em cada bioma e, em seguida, calcule o desvio dessa média em relação à média nacional de desmatamento por imóvel, onde a média nacional deve ser calculada considerando cada imóvel rural desmatado apenas uma vez no país inteiro. Retorne o nome do bioma, o desmatamento médio por imóvel e o desvio em relação à média nacional, ordenando do maior para o menor desvio positivo.", "sql": "WITH media_nacional AS (\n SELECT \n SUM(fd.area_desmatada) / COUNT(DISTINCT fd.cod_imovel) AS media_nacional\n FROM fato_desmatamento fd\n JOIN dim_imovel di ON fd.cod_imovel = di.cod_imovel\n WHERE di.ind_tipo_imovel = 'IRU'\n),\nmedia_bioma AS (\n SELECT \n fd.bioma,\n SUM(fd.area_desmatada) / COUNT(DISTINCT fd.cod_imovel) AS media_bioma,\n COUNT(DISTINCT fd.cod_imovel) AS qtd_imoveis\n FROM fato_desmatamento fd\n JOIN dim_imovel di ON fd.cod_imovel = di.cod_imovel\n WHERE di.ind_tipo_imovel = 'IRU'\n GROUP BY fd.bioma\n)\nSELECT \n mb.bioma,\n mb.media_bioma AS desmatamento_medio_por_imovel,\n (mb.media_bioma - mn.media_nacional) AS desvio_da_media_nacional\n -- mn.media_nacional AS media_nacional\nFROM media_bioma mb\nCROSS JOIN media_nacional mn\nORDER BY desvio_da_media_nacional DESC;", "dificuldade": "difícil", "categorias": [ "desmatamento" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_064", "pergunta": "Para cada estado, qual o percentual de imóveis rurais ativos classificados como Pequeno, Médio e Grande? Apresente como colunas separadas e use os nomes dos estado para cada linha.", "sql": "SELECT\n e.nome_uf AS estado,\n ROUND(\n 100.0 * COUNT(*) FILTER (\n WHERE\n i.class_tam_imovel = 'Pequeno'\n ) / COUNT(*),\n 2\n ) AS pct_pequeno,\n ROUND(\n 100.0 * COUNT(*) FILTER (\n WHERE\n i.class_tam_imovel = 'Médio'\n ) / COUNT(*),\n 2\n ) AS pct_medio,\n ROUND(\n 100.0 * COUNT(*) FILTER (\n WHERE\n i.class_tam_imovel = 'Grande'\n ) / COUNT(*),\n 2\n ) AS pct_grande\n -- COUNT(*) AS total_imoveis\nFROM\n dim_imovel i\n JOIN dim_estado e ON e.cod_uf = i.cod_uf\nWHERE\n i.ind_tipo_imovel = 'IRU'\n AND i.ind_status_imovel = 'AT'\nGROUP BY\n e.nome_uf\nORDER BY\n e.nome_uf;", "dificuldade": "difícil", "categorias": [ "imovel" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_065", "pergunta": "Calcule o percentil de cada imóvel rural ativo em termos de área dentro do seu estado da região Sul. Mostre os imóveis que estão acima do percentil 95. Me dê a área em hectares e o percentil em uma escla de 0 a 100.", "sql": "WITH imoveis_sul AS (\n SELECT\n i.cod_imovel,\n e.sigla_uf,\n i.area_imovel,\n PERCENT_RANK() OVER (PARTITION BY i.cod_uf ORDER BY i.area_imovel) * 100 AS percentil\n FROM dim_imovel i\n JOIN dim_estado e ON i.cod_uf = e.cod_uf\n WHERE i.ind_tipo_imovel = 'IRU'\n AND i.ind_status_imovel = 'AT'\n AND e.sigla_uf IN ('PR', 'SC', 'RS')\n)\nSELECT\n cod_imovel,\n sigla_uf,\n ROUND(area_imovel::numeric, 2) AS area_hectares,\n ROUND(percentil::numeric, 2) AS percentil\nFROM imoveis_sul\nWHERE percentil > 95\nORDER BY sigla_uf, percentil DESC, area_hectares DESC;", "dificuldade": "difícil", "categorias": [ "imovel" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_066", "pergunta": "Para cada unidade de conservação federal, calcule a quantidade de imóveis sobrepostos e a média do percentual de sobreposição. Exiba apenas UCs com mais de 50 imóveis sobrepostos, ranqueadas pela média de sobreposição. Dê cnuc e o nome da UC também. Ordene pela média e pelo nome, sendo a média do maior para o menor.", "sql": "SELECT\n uc.cnuc,\n uc.nomeuc,\n -- uc.siglacateg,\n -- uc.grupouc,\n COUNT(DISTINCT fuc.cod_imovel) AS qtd_imoveis_sobrepostos,\n ROUND(AVG(fuc.percent_car_uc), 2) AS media_percent_sobreposicao\nFROM\n analise_dados.dim_unidades_conservacao uc\n JOIN analise_dados.fato_sobreposicao_unidades_conservacao fuc ON uc.cnuc = fuc.cnuc\nWHERE\n uc.esferaadm = 'Federal'\n AND uc.siglacateg <> 'APA'\nGROUP BY\n uc.cnuc,\n uc.nomeuc,\n uc.siglacateg,\n uc.grupouc\nHAVING\n COUNT(DISTINCT fuc.cod_imovel) > 50\nORDER BY\n media_percent_sobreposicao DESC,\n uc.nomeuc;", "dificuldade": "difícil", "categorias": [ "unidade_conservacao", "sobreposicao" ], "order_matters": true, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_067", "pergunta": "Compare a área declarada no CAR com a área da parcela SIGEF para parcelas com índice de Jaccard abaixo de 0.5. Mostre as 30 maiores discrepâncias absolutas.", "sql": "SELECT\n fs.cod_imovel,\n fs.parcela_codigo,\n di.area_imovel AS area_car,\n ds.area_hectares AS area_sigef,\n fs.indice_jaccard,\n ABS(di.area_imovel - ds.area_hectares) AS discrepancia_absoluta\nFROM analise_dados.fato_similaridade_sigef fs\nJOIN analise_dados.dim_imovel di ON fs.cod_imovel = di.cod_imovel\nJOIN analise_dados.dim_sigef ds ON fs.parcela_codigo = ds.parcela_codigo\nWHERE fs.indice_jaccard < 0.5\nORDER BY discrepancia_absoluta DESC\nLIMIT 30;", "dificuldade": "difícil", "categorias": [ "sigef", "imovel" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_068", "pergunta": "Para cada estado, qual o top 3 de municípios em área desmatada acumulada? Apresente sigla do estado, nome do município, área desmatada em hectares e a posição no ranking estadual.", "sql": "WITH desmat_mun AS (\n SELECT\n de.sigla_uf,\n dm.mun_nome,\n SUM(fd.area_desmatada) AS area_desmatada,\n ROW_NUMBER() OVER (PARTITION BY de.sigla_uf ORDER BY SUM(fd.area_desmatada) DESC) AS rn\n FROM analise_dados.fato_desmatamento fd\n JOIN analise_dados.dim_imovel di ON fd.cod_imovel = di.cod_imovel\n JOIN analise_dados.dim_municipio dm ON CAST(dm.cod_mun AS int4) = di.cod_mun\n JOIN analise_dados.dim_estado de ON CAST(di.cod_uf AS int4) = de.cod_uf\n GROUP BY de.sigla_uf, dm.mun_nome\n)\nSELECT\n sigla_uf,\n mun_nome,\n area_desmatada,\n rn AS posicao_ranking\nFROM desmat_mun\nWHERE rn <= 3\nORDER BY sigla_uf, rn;", "dificuldade": "difícil", "categorias": [ "desmatamento", "imovel" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_069", "pergunta": "Qual o menor e o maior CARs pendente em área por estado da região Nordeste? Mê de o nome do estado, código do CAR, cidade do CAR e o tamnho em km²", "sql": "WITH\n imoveis_nordeste AS (\n SELECT\n e.sigla_uf,\n e.nome_uf,\n i.cod_imovel,\n m.mun_nome,\n i.area_imovel * 0.01 AS area_km2,\n i.ind_status_imovel,\n i.ind_tipo_imovel\n FROM\n dim_imovel i\n JOIN dim_estado e ON i.cod_uf = e.cod_uf\n JOIN dim_municipio m ON i.cod_mun = m.cod_mun\n WHERE\n i.ind_status_imovel = 'PE'\n AND e.sigla_uf IN (\n 'AL',\n 'BA',\n 'CE',\n 'MA',\n 'PB',\n 'PE',\n 'PI',\n 'RN',\n 'SE'\n )\n ),\n rank_areas AS (\n SELECT\n *,\n ROW_NUMBER() OVER (\n PARTITION BY\n sigla_uf\n ORDER BY\n area_km2 ASC\n ) AS rn_min,\n ROW_NUMBER() OVER (\n PARTITION BY\n sigla_uf\n ORDER BY\n area_km2 DESC\n ) AS rn_max\n FROM\n imoveis_nordeste\n )\nSELECT\n nome_uf AS estado,\n cod_imovel,\n mun_nome AS cidade,\n ROUND(area_km2, 2) AS area_km2\nFROM\n rank_areas\nWHERE\n rn_min = 1\n OR rn_max = 1\nORDER BY\n nome_uf,\n area_km2", "dificuldade": "difícil", "categorias": [ "imovel", "geoespacial" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_070", "pergunta": "Mostre o acumulado progressivo (running total) da área desmatada por ano no bioma Amazônia, de 2008 a 2023.", "sql": "WITH desmat_anual AS (\n SELECT\n CAST(fd.ano_desmatamento AS int) AS ano,\n SUM(fd.area_desmatada) AS area_ano\n FROM analise_dados.fato_desmatamento fd\n WHERE fd.bioma = 'Amazônia'\n AND fd.ano_desmatamento BETWEEN 2008 AND 2023\n GROUP BY CAST(fd.ano_desmatamento AS int)\n)\nSELECT\n ano,\n area_ano,\n SUM(area_ano) OVER (ORDER BY ano) AS acumulado_progressivo\nFROM desmat_anual\nORDER BY ano;", "dificuldade": "difícil", "categorias": [ "desmatamento", "temporal" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_071", "pergunta": "Identifique os imóveis rurais que aparecem simultaneamente nas tabelas de sobreposição com embargos, terras indígenas e unidades de conservação. Quantos são por estado?", "sql": "WITH uc_sem_apa AS (\n SELECT DISTINCT\n uc.cod_imovel\n FROM analise_dados.fato_sobreposicao_unidades_conservacao uc\n JOIN analise_dados.dim_unidades_conservacao duc\n ON duc.cnuc = uc.cnuc\n WHERE COALESCE(UPPER(duc.siglacateg), '') <> 'APA'\n),\ntripla_sobrep AS (\n SELECT cod_imovel\n FROM analise_dados.fato_sobreposicao_embargo\n INTERSECT\n SELECT cod_imovel\n FROM analise_dados.fato_sobreposicao_terra_indigena\n INTERSECT\n SELECT cod_imovel\n FROM uc_sem_apa\n)\nSELECT\n est.sigla_uf,\n est.nome_uf,\n COUNT(*) AS qtd_imoveis_tripla_sobrep\nFROM tripla_sobrep t\nJOIN analise_dados.dim_imovel d\n ON d.cod_imovel = t.cod_imovel\nJOIN analise_dados.dim_estado est\n ON est.cod_uf = d.cod_uf\nWHERE d.ind_tipo_imovel = 'IRU'\nGROUP BY\n est.sigla_uf,\n est.nome_uf\nORDER BY\n qtd_imoveis_tripla_sobrep DESC;", "dificuldade": "difícil", "categorias": [ "sobreposicao", "embargo", "terra_indigena", "unidade_conservacao" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_072", "pergunta": "Calcule para cada município do Mato Grosso o total de área desmatada, número de CARs com desmatamento e a área média desmatada por imóvel. Ranqueie pelo total de área desmatada.", "sql": "SELECT \n m.mun_nome AS municipio,\n SUM(d.area_desmatada) AS area_desmatada_total_ha,\n COUNT(DISTINCT d.cod_imovel) AS num_imoveis_com_desmatamento,\n ROUND(SUM(d.area_desmatada) / COUNT(DISTINCT d.cod_imovel), 2) AS area_media_desmatada_por_imovel_ha\nFROM fato_desmatamento d\nJOIN dim_imovel i ON d.cod_imovel = i.cod_imovel\nJOIN dim_municipio m ON i.cod_mun = m.cod_mun\nJOIN dim_estado e ON m.cod_uf = e.cod_uf\nWHERE e.sigla_uf = 'MT'\nGROUP BY m.mun_nome\nORDER BY area_desmatada_total_ha DESC;", "dificuldade": "difícil", "categorias": [ "desmatamento", "imovel" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_073", "pergunta": "Para cada bioma, identifique o ano com maior desmatamento e o ano com menor desmatamento. Mostre os valores correspondentes em ha.", "sql": "WITH desmat_bioma_ano AS (\n SELECT\n fd.bioma,\n CAST(fd.ano_desmatamento AS int) AS ano,\n SUM(fd.area_desmatada) AS area_total\n FROM analise_dados.fato_desmatamento fd\n GROUP BY fd.bioma, CAST(fd.ano_desmatamento AS int)\n),\nranked AS (\n SELECT\n bioma,\n ano,\n area_total,\n ROW_NUMBER() OVER (PARTITION BY bioma ORDER BY area_total DESC) AS rn_max,\n ROW_NUMBER() OVER (PARTITION BY bioma ORDER BY area_total ASC) AS rn_min\n FROM desmat_bioma_ano\n)\nSELECT\n r1.bioma,\n r1.ano AS ano_maior_desmat,\n r1.area_total AS area_maior_desmat,\n r2.ano AS ano_menor_desmat,\n r2.area_total AS area_menor_desmat\nFROM ranked r1\nJOIN ranked r2 ON r1.bioma = r2.bioma AND r2.rn_min = 1\nWHERE r1.rn_max = 1\nORDER BY r1.area_total DESC;", "dificuldade": "difícil", "categorias": [ "desmatamento", "temporal" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_074", "pergunta": "Quais imóveis tiveram desmatamento registrado em 3 ou mais anos distintos no menor estado do Nordeste em área? Mostre o código do imóvel, quantidade de anos, lista de anos divida por virgula sem espaço e a área total desmatada em ha.", "sql": "SELECT\n fd.cod_imovel,\n COUNT(DISTINCT fd.ano_desmatamento) AS quantidade_anos,\n STRING_AGG(DISTINCT CAST(CAST(ROUND(fd.ano_desmatamento) AS INTEGER) AS VARCHAR), ',' ORDER BY CAST(CAST(ROUND(fd.ano_desmatamento) AS INTEGER) AS VARCHAR)) AS lista_anos,\n SUM(fd.area_desmatada) AS area_total_desmatada\nFROM fato_desmatamento fd\nJOIN dim_imovel di ON fd.cod_imovel = di.cod_imovel\nWHERE di.cod_uf = 28\nGROUP BY fd.cod_imovel\nHAVING COUNT(DISTINCT fd.ano_desmatamento) >= 3\nORDER BY quantidade_anos DESC, area_total_desmatada DESC", "dificuldade": "difícil", "categorias": [ "desmatamento", "temporal" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_075", "pergunta": "Identifique UCs do bioma Amazônia que foram criadas antes de 2000 e que possuem mais de 100 imóveis sobrepostos. Mostre o nome da uc, o ano de criação, número de imóveis e área total de sobreposição em ha. Ordene pela quantidade de imóveis (maior para menor)", "sql": "SELECT\n uc.nomeuc AS nome_uc,\n uc.criacaoano AS ano_criacao,\n COUNT(*) AS numero_imoveis,\n ROUND(SUM(f.area_uc_car), 2) AS area_total_sobreposicao_ha\nFROM analise_dados.dim_unidades_conservacao uc\nJOIN analise_dados.fato_sobreposicao_unidades_conservacao f\n ON uc.cnuc = f.cnuc\nWHERE uc.biomaibge = 'AMAZÔNIA'\n AND uc.siglacateg <> 'APA'\n AND CAST(uc.criacaoano AS INTEGER) < 2000\nGROUP BY uc.cnuc, uc.nomeuc, uc.criacaoano\nHAVING COUNT(*) > 100\nORDER BY numero_imoveis DESC;\n", "dificuldade": "difícil", "categorias": [ "unidade_conservacao", "sobreposicao" ], "order_matters": true, "num_column_matters": true, "num_row_matters": true }, { "id": "environmental_registry_benchmark_076", "pergunta": "Me dê a quantidade de embargos por estado em 2023? Use a técnica da maior área para embargos que estão entre estados. Mê de exatamente 2 colunas: nome do estado e quantidade de embargos. Ordene pela quantidade de emb de maneira descendente.", "sql": "WITH embargos_2023 AS (\n -- Filtra embargos do ano de 2023\n SELECT \n id_embargo,\n geo_embargo,\n ST_Area(geo_embargo) as area_total\n FROM dim_embargo\n WHERE SUBSTRING(dat_embarg FROM '\\d{2}/\\d{2}/(\\d{2})') = '23'\n),\ninterseccoes AS (\n -- Calcula a interseção entre cada embargo e cada estado onde ele cruza a fronteira\n SELECT \n e.id_embargo,\n e.area_total,\n est.cod_uf,\n est.sigla_uf,\n est.nome_uf,\n ST_Area(ST_Intersection(e.geo_embargo, est.geo_estado)) as area_interseccao\n FROM embargos_2023 e\n JOIN dim_estado est\n ON ST_Intersects(e.geo_embargo, est.geo_estado)\n),\nranking_estado AS (\n -- Para cada embargo, ranqueia os estados por área de interseção (maior primeiro)\n SELECT \n id_embargo,\n cod_uf,\n sigla_uf,\n nome_uf,\n area_interseccao,\n area_total,\n ROW_NUMBER() OVER (PARTITION BY id_embargo ORDER BY area_interseccao DESC) as rn\n FROM interseccoes\n),\nembargo_estado_maior AS (\n -- Seleciona o estado com a maior área de interseção para cada embargo\n SELECT id_embargo, cod_uf, sigla_uf, nome_uf, area_interseccao, area_total\n FROM ranking_estado\n WHERE rn = 1\n)\n-- Conta embargos por estado\nSELECT \n -- sigla_uf,\n nome_uf,\n COUNT(*) as qtd_embargos\nFROM embargo_estado_maior\nGROUP BY sigla_uf, nome_uf\nORDER BY qtd_embargos DESC;\n", "dificuldade": "difícil", "categorias": [ "terra_indigena", "sobreposicao" ], "order_matters": true, "num_column_matters": true, "num_row_matters": true }, { "id": "environmental_registry_benchmark_077", "pergunta": "Para cada gleba federal, identifique quantos dos imóveis rurais sobrepostos tiveram desmatamento registrado entre 2020 e 2023. Mostre o nome da gleba, a situação, o total de imóveis rurais sobrepostos, quantos possuem desmatamento no período, a área total desmatada nesses imóveis e o percentual de imóveis com desmatamento. ", "sql": "WITH imoveis_gleba AS (\n SELECT\n fitu.id_tu,\n fitu.cod_imovel\n FROM analise_dados.fato_imovel_terra_uniao fitu\n JOIN analise_dados.dim_imovel di\n ON fitu.cod_imovel = di.cod_imovel\n WHERE di.ind_tipo_imovel = 'IRU'\n),\ndesmat_por_imovel_gleba AS (\n SELECT\n ig.id_tu,\n ig.cod_imovel,\n SUM(fd.area_desmatada) AS area_desmatada\n FROM imoveis_gleba ig\n JOIN analise_dados.fato_desmatamento fd\n ON ig.cod_imovel = fd.cod_imovel\n WHERE fd.ano_desmatamento BETWEEN 2020 AND 2023\n GROUP BY ig.id_tu, ig.cod_imovel\n)\nSELECT\n tu.nome_gleba,\n tu.situacao,\n COUNT(DISTINCT ig.cod_imovel) AS total_imoveis_sobrepostos,\n COUNT(DISTINCT dpg.cod_imovel) AS imoveis_com_desmatamento,\n ROUND(COALESCE(SUM(dpg.area_desmatada), 0)::numeric, 2) AS area_desmatamento_total_ha,\n ROUND(\n COUNT(DISTINCT dpg.cod_imovel)::numeric\n / NULLIF(COUNT(DISTINCT ig.cod_imovel), 0) * 100, 2\n ) AS pct_imoveis_com_desmatamento\nFROM analise_dados.dim_terra_uniao tu\nJOIN imoveis_gleba ig\n ON tu.id_tu = ig.id_tu\nLEFT JOIN desmat_por_imovel_gleba dpg\n ON ig.id_tu = dpg.id_tu\n AND ig.cod_imovel = dpg.cod_imovel\nGROUP BY tu.id_tu, tu.nome_gleba, tu.situacao\nORDER BY area_desmatamento_total_ha DESC;", "dificuldade": "difícil", "categorias": [ "terra_uniao", "desmatamento", "sobreposicao", "temporal" ], "order_matters": false, "num_column_matters": true, "num_row_matters": true }, { "id": "environmental_registry_benchmark_078", "pergunta": "Para cada bioma, calcule a evolução anual do desmatamento em imóveis rurais, exibindo a área desmatada no ano e a variação percentual em relação ao ano anterior.", "sql": "WITH\n desmatamento_por_bioma_ano AS (\n SELECT\n fd.bioma,\n CAST(fd.ano_desmatamento AS INTEGER) AS ano,\n SUM(fd.area_desmatada) AS area_desmatada_total\n FROM\n fato_desmatamento fd\n JOIN dim_imovel di ON fd.cod_imovel = di.cod_imovel\n WHERE\n di.ind_tipo_imovel = 'IRU'\n GROUP BY\n fd.bioma,\n CAST(fd.ano_desmatamento AS INTEGER)\n ),\n com_variacao AS (\n SELECT\n bioma,\n ano,\n area_desmatada_total,\n ROUND(\n (\n (\n area_desmatada_total - LAG(area_desmatada_total) OVER (\n PARTITION BY\n bioma\n ORDER BY\n ano\n )\n ) * 100.0 / NULLIF(\n LAG(area_desmatada_total) OVER (\n PARTITION BY\n bioma\n ORDER BY\n ano\n ),\n 0\n )\n ),\n 2\n ) AS variacao_percentual\n FROM\n desmatamento_por_bioma_ano\n )\nSELECT\n bioma,\n ano,\n area_desmatada_total,\n variacao_percentual\nFROM\n com_variacao\nORDER BY\n bioma,\n ano;", "dificuldade": "difícil", "categorias": [ "desmatamento", "temporal" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_079", "pergunta": "Para cada terra indígena na fase 'Homologada', calcule o número de imóveis rurais sobrepostos e a densidade de conflito (área de sobreposição dividida pela área total da TI). Me dê o nome da TI, a área em ha, quantidade de imóveis sobrepostos, área total sobreposta e o cálculo da densidade de conflito bruta.", "sql": "SELECT \n ti.terrai_nom AS nome_ti,\n ti.area_ti_total AS area_ti_ha,\n COUNT(*)::integer AS qtd_imoveis_sobrepostos,\n ROUND(SUM(f.area_ti_car), 2) AS area_total_sobreposta_ha,\n ROUND((SUM(f.area_ti_car) / ti.area_ti_total)::numeric, 4) AS densidade_conflito_bruta\nFROM fato_sobreposicao_terra_indigena f\nJOIN dim_terra_indigena ti \n ON f.terrai_cod = ti.terrai_cod\nJOIN dim_imovel im \n ON f.cod_imovel = im.cod_imovel\nWHERE ti.fase_ti = 'Homologada'\n AND im.ind_tipo_imovel = 'IRU'\nGROUP BY ti.terrai_cod, ti.terrai_nom, ti.area_ti_total\nORDER BY densidade_conflito_bruta DESC;", "dificuldade": "difícil", "categorias": [ "terra_indigena", "sobreposicao" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_080", "pergunta": "Por estado, qual a taxa de inconsistência entre a classificação de tamanho do imóvel e a classe recalculada a partir de num_modulo_fiscal nos imóveis rurais ativos ? Use a siglas do estado para cada linha.", "sql": "WITH base AS (\n SELECT\n e.sigla_uf,\n i.class_tam_imovel,\n i.num_modulo_fiscal,\n CASE\n WHEN i.num_modulo_fiscal <= 4 THEN 'Pequeno'\n WHEN i.num_modulo_fiscal <= 15 THEN 'Médio'\n ELSE 'Grande'\n END AS class_recalculada,\n CASE\n WHEN i.class_tam_imovel <>\n CASE\n WHEN i.num_modulo_fiscal <= 4 THEN 'Pequeno'\n WHEN i.num_modulo_fiscal <= 15 THEN 'Médio'\n ELSE 'Grande'\n END\n THEN 1\n ELSE 0\n END AS inconsistente\n FROM dim_imovel i\n JOIN dim_estado e ON i.cod_uf = e.cod_uf\n WHERE i.ind_tipo_imovel = 'IRU'\n AND i.ind_status_imovel = 'AT'\n AND i.num_modulo_fiscal IS NOT NULL\n)\nSELECT\n sigla_uf,\n COUNT(*) AS total_imoveis,\n SUM(inconsistente) AS imoveis_inconsistentes,\n ROUND(100.0 * SUM(inconsistente) / COUNT(*), 2) AS taxa_inconsistencia_pct\nFROM base\nGROUP BY sigla_uf\nORDER BY taxa_inconsistencia_pct DESC;", "dificuldade": "difícil", "categorias": [ "imovel", "qualidade_dados" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_081", "pergunta": "Entre os estados com pelo menos 50 mil imóveis IRU ativos, qual o ranking por percentual da área total em dupla pressão territorial (imóveis que sobrepõem simultaneamente Terra Indígena e UC não-APA), incluindo percent_rank nacional?", "sql": "WITH imoveis_iru_ativos AS (\n SELECT\n di.cod_imovel,\n di.cod_uf,\n COALESCE(di.area_imovel, 0) AS area_imovel\n FROM analise_dados.dim_imovel di\n WHERE di.ind_tipo_imovel = 'IRU'\n AND di.ind_status_imovel = 'AT'\n),\nestados_elegiveis AS (\n SELECT\n iia.cod_uf\n FROM imoveis_iru_ativos iia\n GROUP BY iia.cod_uf\n HAVING COUNT(*) >= 50000\n),\nimoveis_elegiveis AS (\n SELECT\n iia.cod_uf,\n iia.cod_imovel,\n iia.area_imovel,\n EXISTS (\n SELECT 1\n FROM analise_dados.fato_sobreposicao_terra_indigena fsti\n WHERE fsti.cod_imovel = iia.cod_imovel\n )\n AND EXISTS (\n SELECT 1\n FROM analise_dados.fato_sobreposicao_unidades_conservacao fsuc\n JOIN analise_dados.dim_unidades_conservacao duc\n ON duc.cnuc = fsuc.cnuc\n WHERE fsuc.cod_imovel = iia.cod_imovel\n AND duc.siglacateg <> 'APA'\n ) AS fl_dupla_pressao\n FROM imoveis_iru_ativos iia\n JOIN estados_elegiveis ee\n ON ee.cod_uf = iia.cod_uf\n),\nmetricas_por_estado AS (\n SELECT\n ie.cod_uf,\n COUNT(*) AS total_imoveis_iru_ativos,\n SUM(ie.area_imovel) AS area_total_ha,\n SUM(\n CASE\n WHEN ie.fl_dupla_pressao THEN ie.area_imovel\n ELSE 0\n END\n ) AS area_dupla_pressao_ha\n FROM imoveis_elegiveis ie\n GROUP BY ie.cod_uf\n),\nranking AS (\n SELECT\n mpe.cod_uf,\n mpe.total_imoveis_iru_ativos,\n mpe.area_total_ha,\n mpe.area_dupla_pressao_ha,\n 100.0 * mpe.area_dupla_pressao_ha / NULLIF(mpe.area_total_ha, 0) AS pct_area_dupla_pressao\n FROM metricas_por_estado mpe\n)\nSELECT\n de.sigla_uf AS uf,\n -- de.nome_uf,\n -- r.total_imoveis_iru_ativos,\n -- ROUND(r.area_total_ha::numeric, 2) AS area_total_ha,\n -- ROUND(r.area_dupla_pressao_ha::numeric, 2) AS area_dupla_pressao_ha,\n ROUND(r.pct_area_dupla_pressao::numeric, 4) AS pct_area_dupla_pressao,\n -- DENSE_RANK() OVER (ORDER BY r.pct_area_dupla_pressao DESC) AS rank_entre_estados_elegiveis,\n ROUND(\n PERCENT_RANK() OVER (ORDER BY r.pct_area_dupla_pressao)::numeric,\n 4\n ) AS percent_rank_nacional\nFROM ranking r\nJOIN analise_dados.dim_estado de\n ON de.cod_uf = r.cod_uf\nORDER BY\n r.pct_area_dupla_pressao DESC,\n de.sigla_uf;\n", "dificuldade": "expert", "categorias": [ "unidade_conservacao", "geografico", "geoespacial" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_082", "pergunta": "Nos 3 anos mais recentes com desmatamento na base, qual a participação de cada situação normalizada de Terra da União na área desmatada, atribuindo cada IRU ativo à situação dominante por área de sobreposição?", "sql": "WITH anos_recentes AS (\n SELECT ano_desmatamento\n FROM (\n SELECT DISTINCT fd.ano_desmatamento::int AS ano_desmatamento\n FROM analise_dados.fato_desmatamento fd\n ORDER BY 1 DESC\n LIMIT 3\n ) x\n),\n\niru_ativos_desmat AS (\n SELECT\n fd.cod_imovel,\n SUM(fd.area_desmatada) AS area_desmatada_3a_ha\n FROM analise_dados.fato_desmatamento fd\n JOIN analise_dados.dim_imovel di\n ON di.cod_imovel = fd.cod_imovel\n WHERE fd.ano_desmatamento::int IN (SELECT ano_desmatamento FROM anos_recentes)\n AND di.ind_tipo_imovel = 'IRU'\n AND di.ind_status_imovel = 'AT'\n GROUP BY fd.cod_imovel\n),\n\nterra_uniao_normalizada AS (\n SELECT\n fitu.cod_imovel,\n CASE\n WHEN UPPER(TRIM(COALESCE(dtu.situacao, '-'))) = 'ARREACADADA' THEN 'ARRECADADA'\n WHEN UPPER(TRIM(COALESCE(dtu.situacao, '-'))) = 'CERTIFICADO' THEN 'CERTIFICADA'\n ELSE UPPER(TRIM(COALESCE(dtu.situacao, '-')))\n END AS situacao_normalizada,\n fitu.area_gleba_car\n FROM analise_dados.fato_imovel_terra_uniao fitu\n JOIN analise_dados.dim_terra_uniao dtu\n ON dtu.id_tu = fitu.id_tu\n),\n\narea_por_situacao_imovel AS (\n SELECT\n tun.cod_imovel,\n tun.situacao_normalizada,\n SUM(tun.area_gleba_car) AS area_sobreposicao_ha\n FROM terra_uniao_normalizada tun\n JOIN iru_ativos_desmat iad\n ON iad.cod_imovel = tun.cod_imovel\n GROUP BY\n tun.cod_imovel,\n tun.situacao_normalizada\n),\n\nsituacao_dominante AS (\n SELECT\n apsi.cod_imovel,\n apsi.situacao_normalizada,\n ROW_NUMBER() OVER (\n PARTITION BY apsi.cod_imovel\n ORDER BY apsi.area_sobreposicao_ha DESC, apsi.situacao_normalizada\n ) AS rn\n FROM area_por_situacao_imovel apsi\n),\n\nbase_atribuida AS (\n SELECT\n sd.situacao_normalizada,\n iad.area_desmatada_3a_ha\n FROM situacao_dominante sd\n JOIN iru_ativos_desmat iad\n ON iad.cod_imovel = sd.cod_imovel\n WHERE sd.rn = 1\n),\n\nresultado AS (\n SELECT\n situacao_normalizada,\n SUM(area_desmatada_3a_ha) AS area_desmatada_3a_ha\n FROM base_atribuida\n GROUP BY situacao_normalizada\n)\n\nSELECT\n situacao_normalizada,\n ROUND(area_desmatada_3a_ha::numeric, 2) AS area_desmatada_3a_ha,\n ROUND(\n 100.0 * area_desmatada_3a_ha\n / SUM(area_desmatada_3a_ha) OVER (),\n 2\n ) AS participacao_pct\nFROM resultado\nORDER BY area_desmatada_3a_ha DESC, situacao_normalizada;\n", "dificuldade": "expert", "categorias": [ "geoespacial", "terra_indigena", "geografico" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_083", "pergunta": "Entre os estados com pelo menos 20 IRU ativos sobrepostos a TI, qual tem a maior fração de imóveis que também registraram desmatamento em algum dos 3 anos mais recentes da base?", "sql": "WITH limites AS (\n SELECT\n MAX(ano_desmatamento) AS max_ano\n FROM analise_dados.fato_desmatamento\n),\n\nrecent_desmat AS (\n SELECT DISTINCT\n fd.cod_imovel\n FROM analise_dados.fato_desmatamento fd\n CROSS JOIN limites l\n WHERE\n fd.ano_desmatamento >= l.max_ano - 2\n),\n\nti_imoveis AS (\n SELECT DISTINCT\n de.sigla_uf,\n de.nome_uf,\n di.cod_imovel,\n CASE\n WHEN rd.cod_imovel IS NOT NULL THEN 1\n ELSE 0\n END AS desmatou_recente\n FROM analise_dados.fato_sobreposicao_terra_indigena fti\n JOIN analise_dados.dim_imovel di\n ON di.cod_imovel = fti.cod_imovel\n JOIN analise_dados.dim_estado de\n ON de.cod_uf = di.cod_uf\n LEFT JOIN recent_desmat rd\n ON rd.cod_imovel = di.cod_imovel\n WHERE\n di.ind_tipo_imovel = 'IRU'\n AND di.ind_status_imovel = 'AT'\n)\n\nSELECT\n -- nome_uf,\n sigla_uf,\n COUNT(*) AS qtd_iru_ativos_com_ti,\n SUM(desmatou_recente) AS qtd_iru_com_ti_e_desmatamento_recente,\n ROUND((100.0 * SUM(desmatou_recente) / COUNT(*))::numeric, 2) AS percentual\nFROM ti_imoveis\nGROUP BY\n nome_uf,\n sigla_uf\nHAVING\n COUNT(*) >= 20\nORDER BY\n percentual DESC,\n qtd_iru_com_ti_e_desmatamento_recente DESC,\n sigla_uf\nLIMIT 1;", "dificuldade": "expert", "categorias": [ "geoespacial", "terra_indigena", "sobreposicao", "geografico" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_084", "pergunta": "Entre os municípios com pelo menos 100 IRU ativos, qual tem a maior participação da área desmatada acumulada concentrada em IRU ativos que possuem sobreposição com TI?", "sql": "WITH imoveis_ti AS (\n SELECT DISTINCT\n cod_imovel\n FROM analise_dados.fato_sobreposicao_terra_indigena\n),\n\ndesmat_por_imovel AS (\n SELECT\n cod_imovel,\n SUM(area_desmatada) AS area_desmatada_total_ha\n FROM analise_dados.fato_desmatamento\n GROUP BY\n cod_imovel\n),\n\nmunicipios_validos AS (\n SELECT\n di.cod_mun\n FROM analise_dados.dim_imovel di\n WHERE\n di.ind_tipo_imovel = 'IRU'\n AND di.ind_status_imovel = 'AT'\n GROUP BY\n di.cod_mun\n HAVING\n COUNT(*) >= 100\n),\n\nbase AS (\n SELECT\n dm.mun_nome,\n de.sigla_uf,\n dp.cod_imovel,\n dp.area_desmatada_total_ha,\n CASE\n WHEN iti.cod_imovel IS NOT NULL THEN dp.area_desmatada_total_ha\n ELSE 0\n END AS area_desmatada_em_ti_ha\n FROM desmat_por_imovel dp\n JOIN analise_dados.dim_imovel di\n ON di.cod_imovel = dp.cod_imovel\n JOIN municipios_validos mv\n ON mv.cod_mun = di.cod_mun\n JOIN analise_dados.dim_municipio dm\n ON dm.cod_mun = di.cod_mun\n JOIN analise_dados.dim_estado de\n ON de.cod_uf = di.cod_uf\n LEFT JOIN imoveis_ti iti\n ON iti.cod_imovel = dp.cod_imovel\n WHERE\n di.ind_tipo_imovel = 'IRU'\n AND di.ind_status_imovel = 'AT'\n)\n\nSELECT\n mun_nome,\n -- sigla_uf,\n ROUND(SUM(area_desmatada_em_ti_ha)::numeric, 2) AS area_desmatada_em_iru_com_ti_ha,\n ROUND(SUM(area_desmatada_total_ha)::numeric, 2) AS area_desmatada_total_ha,\n ROUND(\n 100.0 * SUM(area_desmatada_em_ti_ha) / SUM(area_desmatada_total_ha),\n 2\n ) AS percentual\nFROM base\nGROUP BY\n mun_nome,\n sigla_uf\nHAVING\n SUM(area_desmatada_total_ha) > 0\nORDER BY\n percentual DESC,\n area_desmatada_em_iru_com_ti_ha DESC,\n mun_nome\nLIMIT 1;", "dificuldade": "expert", "categorias": [ "geoespacial", "terra_indigena", "geografico" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_085", "pergunta": "Considerando apenas o melhor vínculo CAR de cada parcela SIGEF registrada, qual estado tem o maior gap absoluto entre a média ponderada por área e a média simples do índice de Jaccard?", "sql": "WITH melhor_vinculo AS (\n SELECT\n fs.parcela_codigo,\n fs.cod_imovel,\n fs.indice_jaccard,\n ds.area_hectares,\n ROW_NUMBER() OVER (\n PARTITION BY fs.parcela_codigo\n ORDER BY\n fs.indice_jaccard DESC NULLS LAST,\n fs.area_sigef_car DESC NULLS LAST,\n fs.cod_imovel\n ) AS rn\n FROM analise_dados.fato_similaridade_sigef fs\n JOIN analise_dados.dim_sigef ds\n ON ds.parcela_codigo = fs.parcela_codigo\n WHERE\n ds.status = 'REGISTRADA'\n AND fs.indice_jaccard IS NOT NULL\n AND ds.area_hectares IS NOT NULL\n)\nSELECT\n -- de.nome_uf,\n de.sigla_uf,\n ROUND(AVG(mv.indice_jaccard)::numeric, 6) AS media_simples_jaccard,\n ROUND(\n (SUM(mv.indice_jaccard * mv.area_hectares) / NULLIF(SUM(mv.area_hectares), 0))::numeric,\n 6\n ) AS media_ponderada_jaccard,\n ROUND(\n ABS(\n SUM(mv.indice_jaccard * mv.area_hectares) / NULLIF(SUM(mv.area_hectares), 0)\n - AVG(mv.indice_jaccard)\n )::numeric,\n 6\n ) AS gap_absoluto\nFROM melhor_vinculo mv\nJOIN analise_dados.dim_imovel di\n ON di.cod_imovel = mv.cod_imovel\nJOIN analise_dados.dim_estado de\n ON de.cod_uf = di.cod_uf\nWHERE mv.rn = 1\nGROUP BY de.nome_uf, de.sigla_uf\nORDER BY gap_absoluto DESC, de.sigla_uf\nLIMIT 1;\n", "dificuldade": "expert", "categorias": [ "terra_indigena", "imovel", "geoespacial" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_086", "pergunta": "Encontre os 20 imóveis IRU ativos mais paradoxais e retorne as colunas:\n- sigla_uf\n- cod_imovel\n- max_pct_uc\n- max_jaccard\n- area_desmat_total_ha\n- mediana_desmatamento_uf\n- score_paradoxo\n\nConsidere apenas sobreposição com Unidade de Conservação não-APA e imóveis com similaridade SIGEF. O desmatamento deve ser o acumulado por imóvel, e o imóvel só deve entrar no resultado se seu desmatamento acumulado estiver acima da mediana do desmatamento acumulado dos imóveis IRU ativos da mesma UF, considerando imóveis sem desmatamento como zero no cálculo da mediana. Calcule o score composto como max_pct_uc * max_jaccard * ln(1 + desmatamento acumulado), ordene do maior para o menor score e limite a 20 resultados.\n", "sql": "WITH imoveis_iru_ativos AS (\n SELECT\n di.cod_imovel,\n di.cod_uf\n FROM analise_dados.dim_imovel di\n WHERE di.ind_tipo_imovel = 'IRU'\n AND di.ind_status_imovel = 'AT'\n),\ndesmatamento_acumulado AS (\n SELECT\n fd.cod_imovel,\n SUM(fd.area_desmatada) AS desmatamento_total_ha\n FROM analise_dados.fato_desmatamento fd\n JOIN imoveis_iru_ativos i\n ON i.cod_imovel = fd.cod_imovel\n GROUP BY fd.cod_imovel\n),\nbase_iru AS (\n SELECT\n i.cod_imovel,\n i.cod_uf,\n COALESCE(d.desmatamento_total_ha, 0) AS desmatamento_total_ha\n FROM imoveis_iru_ativos i\n LEFT JOIN desmatamento_acumulado d\n ON d.cod_imovel = i.cod_imovel\n),\nmediana_uf AS (\n SELECT\n b.cod_uf,\n PERCENTILE_CONT(0.5) WITHIN GROUP (\n ORDER BY b.desmatamento_total_ha\n ) AS mediana_desmatamento_uf\n FROM base_iru b\n GROUP BY b.cod_uf\n),\nacima_mediana AS (\n SELECT\n b.cod_imovel,\n b.cod_uf,\n b.desmatamento_total_ha\n FROM base_iru b\n JOIN mediana_uf m\n ON m.cod_uf = b.cod_uf\n WHERE b.desmatamento_total_ha > m.mediana_desmatamento_uf\n),\nmax_uc_nao_apa AS (\n SELECT\n fsuc.cod_imovel,\n MAX(fsuc.percent_car_uc) AS max_pct_uc\n FROM analise_dados.fato_sobreposicao_unidades_conservacao fsuc\n JOIN analise_dados.dim_unidades_conservacao duc\n ON duc.cnuc = fsuc.cnuc\n WHERE COALESCE(UPPER(duc.siglacateg), '') <> 'APA'\n GROUP BY fsuc.cod_imovel\n),\nmax_sigef AS (\n SELECT\n fss.cod_imovel,\n MAX(fss.indice_jaccard) AS max_jaccard\n FROM analise_dados.fato_similaridade_sigef fss\n GROUP BY fss.cod_imovel\n),\ncandidatos AS (\n SELECT\n a.cod_imovel,\n a.cod_uf,\n a.desmatamento_total_ha,\n uc.max_pct_uc,\n sg.max_jaccard\n FROM acima_mediana a\n JOIN max_uc_nao_apa uc\n ON uc.cod_imovel = a.cod_imovel\n JOIN max_sigef sg\n ON sg.cod_imovel = a.cod_imovel\n)\nSELECT\n de.sigla_uf,\n c.cod_imovel,\n ROUND(c.max_pct_uc::numeric, 4) AS max_pct_uc,\n ROUND(c.max_jaccard::numeric, 4) AS max_jaccard,\n ROUND(c.desmatamento_total_ha::numeric, 2) AS area_desmat_total_ha,\n ROUND(m.mediana_desmatamento_uf::numeric, 2) AS mediana_desmatamento_uf,\n ROUND(\n (\n c.max_pct_uc * c.max_jaccard * LN(1 + c.desmatamento_total_ha)\n )::numeric,\n 4\n ) AS score_paradoxo\nFROM candidatos c\nJOIN mediana_uf m\n ON m.cod_uf = c.cod_uf\nJOIN analise_dados.dim_estado de\n ON de.cod_uf = c.cod_uf\nORDER BY\n score_paradoxo DESC,\n c.max_pct_uc DESC,\n c.max_jaccard DESC,\n c.desmatamento_total_ha DESC\nLIMIT 20;\n", "dificuldade": "expert", "categorias": [ "imovel", "geoespacial" ], "order_matters": true, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_087", "pergunta": "Considerando apenas os imóveis rurais que possuem pelo menos um embargo, e definindo a severidade de cada imóvel como o maior valor de percent_car_embargos entre todos os seus embargos (MAX(percent_car_embargos) por cod_imovel), calcule, para cada UF, qual percentual da soma da area_imovel pertence aos imóveis que estão no decil superior nacional de severidade (isto é, acima ou igual ao percentil 90 calculado sobre todos os imóveis do Brasil, e não separadamente por estado). Retorne: sigla da UF, quantidade de imóveis com embargo, quantidade de imóveis no decil superior, área total dos imóveis com embargo (area_imovel, em ha), área total dos imóveis no decil superior (area_imovel, em ha) e o percentual dessa área sobre a área total dos imóveis com embargo da UF.", "sql": "WITH base AS (\n SELECT\n di.cod_imovel,\n di.cod_uf,\n di.area_imovel,\n MAX(fse.percent_car_embargos) AS max_percent_emb\n FROM analise_dados.dim_imovel di\n JOIN analise_dados.fato_sobreposicao_embargo fse\n ON fse.cod_imovel = di.cod_imovel\n WHERE\n di.ind_tipo_imovel = 'IRU'\n AND di.area_imovel IS NOT NULL\n GROUP BY\n di.cod_imovel,\n di.cod_uf,\n di.area_imovel\n),\nthreshold AS (\n SELECT\n PERCENTILE_CONT(0.90) WITHIN GROUP (ORDER BY max_percent_emb) AS p90\n FROM base\n)\nSELECT\n de.sigla_uf,\n -- de.nome_uf,\n COUNT(*) AS imoveis_com_embargo,\n COUNT(*) FILTER (WHERE b.max_percent_emb >= t.p90) AS imoveis_top_decile,\n ROUND(SUM(b.area_imovel), 2) AS area_total_imoveis_embargados_ha,\n ROUND(SUM(b.area_imovel) FILTER (WHERE b.max_percent_emb >= t.p90), 2) AS area_top_decile_ha,\n ROUND(\n 100.0 * SUM(b.area_imovel) FILTER (WHERE b.max_percent_emb >= t.p90)\n / NULLIF(SUM(b.area_imovel), 0),\n 4\n ) AS pct_area_top_decile\nFROM base b\nCROSS JOIN threshold t\nJOIN analise_dados.dim_estado de\n ON de.cod_uf = b.cod_uf\nGROUP BY\n de.sigla_uf,\n de.nome_uf\nORDER BY\n pct_area_top_decile DESC,\n de.sigla_uf;\n", "dificuldade": "expert", "categorias": [ "unidade_conservacao", "geoespacial" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_088", "pergunta": "Quais são as 15 Terras Indígenas regularizadas com maior razão invasão/área (soma de area_ti_car sobre area_ti_total), considerando apenas imóveis IRU ativos?", "sql": "SELECT\n ti.terrai_nom,\n -- ROUND(ti.area_ti_total::numeric, 2) AS area_ti_total_ha,\n -- ROUND(SUM(s.area_ti_car), 2) AS area_invasao_hectares,\n ROUND(\n SUM(s.area_ti_car) / NULLIF(ti.area_ti_total::numeric, 0),\n 4\n ) AS razao_invasao_area\nFROM analise_dados.fato_sobreposicao_terra_indigena s\nJOIN analise_dados.dim_terra_indigena ti\n ON ti.terrai_cod = s.terrai_cod\nJOIN analise_dados.dim_imovel im\n ON im.cod_imovel = s.cod_imovel\nWHERE ti.fase_ti = 'Regularizada'\n AND im.ind_tipo_imovel = 'IRU'\n AND im.ind_status_imovel = 'AT'\n AND ti.area_ti_total > 0\nGROUP BY\n ti.terrai_cod,\n ti.terrai_nom,\n ti.etnia_nome,\n ti.area_ti_total\nORDER BY razao_invasao_area DESC\nLIMIT 15;\n", "dificuldade": "expert", "categorias": [ "terra_indigena", "geoespacial" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_089", "pergunta": "Selecione as maiores cidades em área de cada região do Brasil. Em seguida, calcule o baricentro do polígono formado pelos centroides dessas cidades. Por fim, informe o nome da cidade onde esse baricentro está localizado, juntamente com o estado (nome) e a quantidade de CARs.", "sql": "WITH municipio_regiao AS (\n SELECT\n m.cod_mun,\n m.mun_nome,\n m.cod_uf,\n m.geo_mun,\n CASE (m.cod_uf / 10)\n WHEN 1 THEN 'Norte'\n WHEN 2 THEN 'Nordeste'\n WHEN 3 THEN 'Sudeste'\n WHEN 4 THEN 'Sul'\n WHEN 5 THEN 'Centro-Oeste'\n END AS regiao,\n ROW_NUMBER() OVER (\n PARTITION BY (m.cod_uf / 10)\n ORDER BY ST_Area(m.geo_mun) DESC\n ) AS rn\n FROM analise_dados.dim_municipio m\n WHERE m.geo_mun IS NOT NULL\n),\n\n-- 1) Maior município de cada região\nmaiores_por_regiao AS (\n SELECT cod_mun, mun_nome, cod_uf, geo_mun, regiao\n FROM municipio_regiao\n WHERE rn = 1\n),\n\n-- 2) Baricentro do polígono formado pelos centroides das 5 cidades\nbaricentro AS (\n SELECT\n ST_Centroid(\n ST_ConvexHull(\n ST_Collect(ST_Centroid(geo_mun))\n )\n ) AS ponto\n FROM maiores_por_regiao\n),\n\n-- 3) Município que contém o baricentro\ncidade_baricentro AS (\n SELECT\n m.cod_mun,\n m.mun_nome,\n m.cod_uf\n FROM analise_dados.dim_municipio m\n CROSS JOIN baricentro b\n WHERE ST_Contains(m.geo_mun, b.ponto)\n LIMIT 1\n)\n\nSELECT\n cb.mun_nome AS municipio,\n de.nome_uf AS estado,\n COUNT(di.cod_imovel) AS qtd_cars\nFROM cidade_baricentro cb\nJOIN analise_dados.dim_estado de\n ON de.cod_uf = cb.cod_uf\nLEFT JOIN analise_dados.dim_imovel di\n ON di.cod_mun = cb.cod_mun\nGROUP BY\n cb.mun_nome,\n de.nome_uf;", "dificuldade": "expert", "categorias": [ "desmatamento", "sobreposicao", "imovel" ], "order_matters": false, "num_column_matters": false, "num_row_matters": true }, { "id": "environmental_registry_benchmark_090", "pergunta": "Para cada ano de desmatamento no bioma Amazônia, calcule o **centroide geográfico ponderado pela área desmatada** — ou seja, a média ponderada das coordenadas `latitude_desmatamento` e `longitude_desmatamento`, usando `area_desmatada` como peso. Em seguida, identifique o **município cujo centroide geométrico é mais próximo** desse ponto ponderado (usando `ST_Distance` entre o centroide do polígono do município e o ponto ponderado, transformando as coordenadas geográficas para o SRID 5880 das geometrias municipais).\n\nPara cada ano, informe:\n- **Ano**\n- **Município mais próximo** ao centroide ponderado\n- **Estado** (nome)\n- **Área total desmatada** no bioma Amazônia naquele ano (hectares, arredondada a 2 casas decimais)\n- **Latitude e longitude do centroide ponderado** (arredondadas a 6 casas decimais)\n- **Análise de migração do centro de gravidade** em relação ao ano anterior, classificada como:\n - `Início da série` para o primeiro ano\n - `Centro de gravidade estável em relação ao ano anterior` quando município e estado coincidem com o ano anterior\n - Direção cardeal ou intercardeal do deslocamento (ex.: `Migrou para nordeste em relação ao ano anterior`, `Migrou para sudoeste em relação ao ano anterior`, etc.), determinada pela variação das coordenadas do centroide ponderado entre anos consecutivos (latitude maior → norte; longitude maior → leste)\n\nOrdene cronologicamente.", "sql": "WITH desmatamento_amazonia_ano AS (\n SELECT\n CAST(ano_desmatamento AS integer) AS ano,\n SUM(area_desmatada) AS area_total_desmatada_ha,\n SUM(latitude_desmatamento * area_desmatada)\n / NULLIF(SUM(area_desmatada), 0) AS latitude_centroide_ponderado,\n SUM(longitude_desmatamento * area_desmatada)\n / NULLIF(SUM(area_desmatada), 0) AS longitude_centroide_ponderado\n FROM fato_desmatamento\n WHERE bioma = 'Amazônia'\n AND area_desmatada IS NOT NULL\n AND latitude_desmatamento IS NOT NULL\n AND longitude_desmatamento IS NOT NULL\n GROUP BY CAST(ano_desmatamento AS integer)\n),\ncentroides_municipios AS (\n SELECT\n m.mun_nome,\n e.nome_uf,\n ST_Centroid(m.geo_mun) AS centroide_municipio\n FROM dim_municipio AS m\n JOIN dim_estado AS e\n ON e.cod_uf = m.cod_uf\n),\ndistancias AS (\n SELECT\n d.ano,\n d.area_total_desmatada_ha,\n d.latitude_centroide_ponderado,\n d.longitude_centroide_ponderado,\n cm.mun_nome,\n cm.nome_uf,\n ROW_NUMBER() OVER (\n PARTITION BY d.ano\n ORDER BY ST_Distance(\n cm.centroide_municipio,\n ST_Transform(\n ST_SetSRID(\n ST_MakePoint(\n d.longitude_centroide_ponderado,\n d.latitude_centroide_ponderado\n ),\n 4674\n ),\n 5880\n )\n ) ASC, cm.mun_nome ASC\n ) AS rn\n FROM desmatamento_amazonia_ano AS d\n CROSS JOIN centroides_municipios AS cm\n),\nmais_proximo_por_ano AS (\n SELECT *\n FROM distancias\n WHERE rn = 1\n)\nSELECT\n ano,\n mun_nome AS municipio_mais_proximo_ao_centroide_ponderado,\n nome_uf AS estado,\n ROUND(area_total_desmatada_ha, 2) AS area_total_desmatada_ha,\n ROUND(latitude_centroide_ponderado, 6) AS latitude_centroide_ponderado,\n ROUND(longitude_centroide_ponderado, 6) AS longitude_centroide_ponderado,\n CASE\n WHEN LAG(mun_nome) OVER (ORDER BY ano) IS NULL\n THEN 'Início da série'\n WHEN mun_nome = LAG(mun_nome) OVER (ORDER BY ano)\n AND nome_uf = LAG(nome_uf) OVER (ORDER BY ano)\n THEN 'Centro de gravidade estável em relação ao ano anterior'\n WHEN latitude_centroide_ponderado > LAG(latitude_centroide_ponderado) OVER (ORDER BY ano)\n AND longitude_centroide_ponderado > LAG(longitude_centroide_ponderado) OVER (ORDER BY ano)\n THEN 'Migrou para nordeste em relação ao ano anterior'\n WHEN latitude_centroide_ponderado > LAG(latitude_centroide_ponderado) OVER (ORDER BY ano)\n AND longitude_centroide_ponderado < LAG(longitude_centroide_ponderado) OVER (ORDER BY ano)\n THEN 'Migrou para noroeste em relação ao ano anterior'\n WHEN latitude_centroide_ponderado < LAG(latitude_centroide_ponderado) OVER (ORDER BY ano)\n AND longitude_centroide_ponderado > LAG(longitude_centroide_ponderado) OVER (ORDER BY ano)\n THEN 'Migrou para sudeste em relação ao ano anterior'\n WHEN latitude_centroide_ponderado < LAG(latitude_centroide_ponderado) OVER (ORDER BY ano)\n AND longitude_centroide_ponderado < LAG(longitude_centroide_ponderado) OVER (ORDER BY ano)\n THEN 'Migrou para sudoeste em relação ao ano anterior'\n WHEN latitude_centroide_ponderado = LAG(latitude_centroide_ponderado) OVER (ORDER BY ano)\n AND longitude_centroide_ponderado > LAG(longitude_centroide_ponderado) OVER (ORDER BY ano)\n THEN 'Migrou para leste em relação ao ano anterior'\n WHEN latitude_centroide_ponderado = LAG(latitude_centroide_ponderado) OVER (ORDER BY ano)\n AND longitude_centroide_ponderado < LAG(longitude_centroide_ponderado) OVER (ORDER BY ano)\n THEN 'Migrou para oeste em relação ao ano anterior'\n WHEN latitude_centroide_ponderado > LAG(latitude_centroide_ponderado) OVER (ORDER BY ano)\n AND longitude_centroide_ponderado = LAG(longitude_centroide_ponderado) OVER (ORDER BY ano)\n THEN 'Migrou para norte em relação ao ano anterior'\n WHEN latitude_centroide_ponderado < LAG(latitude_centroide_ponderado) OVER (ORDER BY ano)\n AND longitude_centroide_ponderado = LAG(longitude_centroide_ponderado) OVER (ORDER BY ano)\n THEN 'Migrou para sul em relação ao ano anterior'\n ELSE 'Sem variação identificável'\n END AS analise_migracao\nFROM mais_proximo_por_ano\nORDER BY ano;", "dificuldade": "expert", "categorias": [ "terra_indigena", "unidade_conservacao", "geoespacial" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_106", "pergunta": "Em Ouro Branco, a proporção de imóveis grandes é alta ou baixa?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "municipality_name", "homonym" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_107", "pergunta": "Viçosa ou Triunfo: onde os imóveis ativos ocupam mais área no total?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "municipality_name", "homonym" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_108", "pergunta": "Jussara tem muito CAR com embargo ou é só impressão?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "municipality_name", "homonym" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_109", "pergunta": "Se eu olhar só os imóveis suspensos, Nova Olinda aparece pior que Novo Horizonte?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "municipality_name", "homonym" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_110", "pergunta": "Em Cantagalo, qual é o tamanho do maior imóvel rural?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "municipality_name", "homonym" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_111", "pergunta": "Belém tem mais CAR ativo ou mais CAR pendente?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "municipality_name", "homonym" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_112", "pergunta": "Entre Boa Esperança, Mundo Novo e Santa Cruz, qual município parece mais pressionado por embargo?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "municipality_name", "homonym" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_113", "pergunta": "Estou tentando lembrar se Cachoeira Dourada tinha muito CAR; consegue me passar o total sem abrir os detalhes?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "municipality_name", "homonym" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_114", "pergunta": "Qual Santa Inês fica mais perto de Bom Jardim pelos centroides?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "municipality_name", "homonym" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_115", "pergunta": "São Francisco lidera em área média de imóvel ou não?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "municipality_name", "homonym" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_116", "pergunta": "Me ajuda numa dúvida rápida: Água Branca tem mais CAR ativo ou suspenso?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "municipality_name", "homonym" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_117", "pergunta": "Em Alto Alegre, o volume de imóveis grandes chama atenção?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "municipality_name", "homonym" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_118", "pergunta": "Se eu cruzar Cruzeiro do Sul com Itambé, onde há mais CAR com desmatamento acumulado?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "municipality_name", "homonym" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_119", "pergunta": "Estou montando um recorte do Sul de Minas; quantos CARs entram aí?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "informal_region", "geographic_scope" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_120", "pergunta": "Para o Vale do Jequitinhonha, eu queria a soma da área dos imóveis ativos por município.", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "informal_region", "geographic_scope" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_121", "pergunta": "No Vale do Aço, qual cidade carrega mais embargos ligados a imóveis rurais?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "informal_region", "geographic_scope" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_122", "pergunta": "Me passa a quantidade de CARs da Zona da Mata mineira.", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "informal_region", "geographic_scope" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_123", "pergunta": "No Triângulo Mineiro, quais municípios mais concentram imóveis grandes?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "informal_region", "geographic_scope" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_124", "pergunta": "Para o Norte de Minas, o desmatamento de 2024 ficou concentrado em poucos municípios ou espalhado?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "informal_region", "geographic_scope" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_125", "pergunta": "Queria um total de CARs do Oeste baiano, sem precisar listar município por município.", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "informal_region", "geographic_scope" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_126", "pergunta": "No Vale do Paraíba, onde os imóveis rurais grandes mais se concentram?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "informal_region", "geographic_scope" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_127", "pergunta": "Baixada Santista tem muito CAR se sobrepondo entre si?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "informal_region", "geographic_scope" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_128", "pergunta": "Serra da Mantiqueira me interessa só pela quantidade de imóveis ativos; você consegue fechar esse número?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "informal_region", "geographic_scope" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_129", "pergunta": "Para o semiárido, eu queria a média de área dos imóveis rurais.", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "informal_region", "geographic_scope" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_130", "pergunta": "MATOPIBA está puxando mais para cima a quantidade de imóveis ou a área total?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "informal_region", "geographic_scope" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_131", "pergunta": "Bom Sucesso está pior por quantidade de imóveis ou por área total cadastrada?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "metric_definition", "needs_operationalization" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_132", "pergunta": "No caso de São Domingos, o que pesa mais: quantidade de imóveis ou área total deles?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "metric_definition", "needs_operationalization" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_133", "pergunta": "Entre Bonito e Santa Helena, onde a situação fundiária parece mais complicada?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "metric_definition", "needs_operationalization" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_134", "pergunta": "Em Ouro Branco, o maior CAR é muito fora da curva ou acompanha a média?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "metric_definition", "needs_operationalization" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_135", "pergunta": "Campo Grande aparece mais por área ou por quantidade de imóveis?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "metric_definition", "needs_operationalization" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_136", "pergunta": "Em Jussara, os imóveis grandes concentram a maior parte da área?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "metric_definition", "needs_operationalization" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_137", "pergunta": "Quero saber onde a pressão parece maior entre Bom Jesus, Bom Sucesso e Bom Jardim, mas sem ficar me enchendo de ranking.", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "metric_definition", "needs_operationalization" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_138", "pergunta": "Se eu tiver que escolher um estado como o mais enrolado fundiariamente, qual sairia?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "metric_definition", "needs_operationalization" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_139", "pergunta": "Qual município tem mais conflito fundiário?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "metric_definition", "needs_operationalization" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_140", "pergunta": "O que seria o município mais crítico se eu quiser misturar embargo, desmatamento e sobreposição?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "metric_definition", "needs_operationalization" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_141", "pergunta": "Sobre a Paquiçamba, eu só queria saber em quais municípios ela cai hoje.", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "entity_type", "homonym" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_142", "pergunta": "Kariri-Xocó já está regularizada ou ainda não?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "entity_type", "homonym" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_143", "pergunta": "PA Bom Jesus está sobrando capacidade ou faltando?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "entity_type", "homonym" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_144", "pergunta": "São José, como terra da União, está regular ou enrolada?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "entity_type", "homonym" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_145", "pergunta": "Qual parque estadual fica na Serra Negra?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "entity_type", "homonym" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_146", "pergunta": "Qual é a distância entre São Paulo e São João dos Pinhais usando os centroides?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "entity_type", "homonym" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_147", "pergunta": "Ibituru está com quantos CARs ativos hoje?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "typo", "near_match" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_148", "pergunta": "Paraopebas tem mais embargo ou mais desmatamento em 2024?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "typo", "near_match" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_149", "pergunta": "Uberlandeia está puxando muita área de imóvel grande?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "typo", "near_match" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_150", "pergunta": "Na TI Paquiçambaa, quantos CARs ativos se sobrepõem?", "sql": "clarification", "dificuldade": "fácil", "categorias": [ "typo", "near_match" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_151", "pergunta": "Na Amazônia, quantas áreas não destinadas existem afinal?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "schema_gap", "unsupported_output" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_152", "pergunta": "Perto de Belo Horizonte, qual parque estadual aparece primeiro?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "schema_gap", "unsupported_output" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_154", "pergunta": "Depois que o banco começou a registrar isso, qual TI mais recebeu sobreposição?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "schema_gap", "unsupported_output" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_155", "pergunta": "Os assentamentos mais recentes estão lotando rápido ou devagar?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "schema_gap", "unsupported_output" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_156", "pergunta": "APP e Reserva Legal aparecem separadas no banco? Se sim, quantos imóveis estão nas duas ao mesmo tempo?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "schema_gap", "unsupported_output" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_157", "pergunta": "Me entrega um gráfico da evolução dos embargos por bioma para eu bater o olho.", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "schema_gap", "unsupported_output" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_158", "pergunta": "Qual terra militar no Mato Grosso encosta em mais imóveis ativos?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "schema_gap", "unsupported_output" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_159", "pergunta": "Dá para localizar a bacia hidrográfica com mais desmatamento em 2024?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "schema_gap", "unsupported_output" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_160", "pergunta": "Qual UC estadual mais sofre com sobreposição de CAR? Se o nome oficial estiver diferente, pode usar o popular.", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "schema_gap", "unsupported_output" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_161", "pergunta": "Terras TI com sobreposição a terras militares, quais são?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "schema_gap", "unsupported_output" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_162", "pergunta": "Na cidade de Serra Negra, qual é o parque estadual que mais tem sobreposição de CAR?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "schema_gap", "unsupported_output" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_163", "pergunta": "Dá para me falar o PIB do estado campeão de embargos em 2023 sem sair do banco?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "external_dataset", "cross_system" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_164", "pergunta": "Qual desses municípios mais embargados tem o pior IDHM?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "external_dataset", "cross_system" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_165", "pergunta": "Nas áreas com mais sobreposição de CAR, chove mais ou menos que a média do estado?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "external_dataset", "cross_system" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_166", "pergunta": "Tem como descobrir qual rodovia federal corta mais Terras Indígenas?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "external_dataset", "cross_system" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_167", "pergunta": "Qual é a qualidade da água do município com mais embargos?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "external_dataset", "cross_system" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_168", "pergunta": "Entre os municípios com TIs, qual tem mais escolas indígenas dentro do território?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "external_dataset", "cross_system" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_169", "pergunta": "A precipitação média anual ajuda a explicar as UCs com mais CAR por cima?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "external_dataset", "cross_system" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_170", "pergunta": "Você consegue cruzar os municípios com mais CAR ativo e dizer qual deles tem a maior população?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "external_dataset", "cross_system" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_171", "pergunta": "No município com maior estoque de embargos, como está a renda per capita?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "external_dataset", "cross_system" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_172", "pergunta": "Qual cidade tem mais registro no ANA?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "external_dataset", "cross_system" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_173", "pergunta": "Qual município tem mais registros de outorga da ANA sobrepostos a imóveis rurais?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "ana", "hydrology" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_174", "pergunta": "Entre os CARs ativos, quais têm captação de água cadastrada na ANA?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "ana", "hydrology" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_175", "pergunta": "Na Amazônia Legal, os CARs com mais embargo também estão perto de rios monitorados pela ANA?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "ana", "hydrology" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_176", "pergunta": "Qual estado concentra mais pontos de monitoramento hidrológico da ANA em imóveis com desmatamento?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "ana", "hydrology" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_177", "pergunta": "No Vale do São Francisco, qual cidade tem mais outorgas da ANA em área de CAR?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "ana", "hydrology" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_178", "pergunta": "Entre os imóveis rurais grandes, quais estão mais próximos de reservatórios da ANA?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "ana", "hydrology" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_179", "pergunta": "Quais CARs têm alerta de desmatamento do DETER/INPE em 2024?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "inpe_ibama_dnit", "external_monitoring" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_180", "pergunta": "Me mostra os imóveis com mais focos de calor do INPE no último ano.", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "inpe_ibama_dnit", "external_monitoring" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_181", "pergunta": "Qual estado teve mais queimadas do INPE dentro de imóveis rurais ativos?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "inpe_ibama_dnit", "external_monitoring" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_182", "pergunta": "Entre os municípios com mais desmatamento em CAR, quais também lideram em focos de calor do INPE?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "inpe_ibama_dnit", "external_monitoring" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_183", "pergunta": "Tem algum imóvel rural com alerta DETER do INPE e embargo ao mesmo tempo?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "inpe_ibama_dnit", "external_monitoring" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_184", "pergunta": "Quero comparar os focos de calor do INPE com os embargos do IBAMA por município.", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "inpe_ibama_dnit", "external_monitoring" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_185", "pergunta": "Qual município tem mais áreas embargadas pelo IBAMA com valor de multa mais alto?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "inpe_ibama_dnit", "external_monitoring" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_187", "pergunta": "Quais CARs estão a menos de 5 km de rodovias federais do DNIT?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "inpe_ibama_dnit", "external_monitoring" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_188", "pergunta": "Qual TI cruza mais quilômetros de rodovia do DNIT?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "inpe_ibama_dnit", "external_monitoring" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_189", "pergunta": "Qual município com muito CAR também tem maior população segundo o IBGE?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "ibge_aneel_inmet_anm_incra_funai_icmbio", "external_public_data" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_190", "pergunta": "Entre os estados com mais imóveis rurais, qual tem maior PIB do IBGE?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "ibge_aneel_inmet_anm_incra_funai_icmbio", "external_public_data" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_191", "pergunta": "Qual cidade com mais embargo tem a menor população estimada pelo IBGE?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "ibge_aneel_inmet_anm_incra_funai_icmbio", "external_public_data" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_192", "pergunta": "Quero o rendimento médio do município com maior área desmatada em CAR.", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "ibge_aneel_inmet_anm_incra_funai_icmbio", "external_public_data" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_193", "pergunta": "Quais imóveis estão mais perto de usinas hidrelétricas da ANEEL?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "ibge_aneel_inmet_anm_incra_funai_icmbio", "external_public_data" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_194", "pergunta": "Qual município com mais embargo também tem estação do INMET?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "ibge_aneel_inmet_anm_incra_funai_icmbio", "external_public_data" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_195", "pergunta": "Qual município tem mais processos minerários da ANM sobre imóveis CAR?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "ibge_aneel_inmet_anm_incra_funai_icmbio", "external_public_data" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_198", "pergunta": "Qual parque nacional do banco recebe mais visitantes segundo o ICMBio?", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "ibge_aneel_inmet_anm_incra_funai_icmbio", "external_public_data" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false }, { "id": "environmental_registry_benchmark_200", "pergunta": "Quero o número de UBS do SUS no município com maior estoque de CAR.", "sql": "unanswerable", "dificuldade": "fácil", "categorias": [ "ibge_aneel_inmet_anm_incra_funai_icmbio", "external_public_data" ], "order_matters": false, "num_column_matters": false, "num_row_matters": false } ]