id int64 1 60 | question stringlengths 31 140 | possible_query stringlengths 29 217 | complexity stringclasses 3
values | answer stringlengths 1 18.1k | required_tables sequencelengths 1 2 |
|---|---|---|---|---|---|
1 | List basic cnpj for the 'RN' state in the 'establishment' table. | SELECT basic_cnpj FROM establishment WHERE state = 'RN'; | Easy | 27817200; 32859505; 32999742; 04087496; 24191952; 38530104; 33169122; 38226259 | [
"establishment"
] |
2 | Show the state of all 'Branch' establishments | SELECT state FROM establishment WHERE main_or_branch = 'Branch'; | Easy | SP; RS; SP; CE; TO; MA; MG; MA; SP; RJ; SP; PR; AM; SP; ES; PR; SP; SP; GO; CE; RS; SP; PA; PR; MG; SP; SE; SP; RN; SP; SP; RO; BA; SP; GO; SP; SP; RS; SP; SP; SP; SP; SP; RJ; RJ; SC; SP; CE; RJ; SP; MG; RJ; MG; MG | [
"establishment"
] |
3 | What is the total capital in the company table? | SELECT SUM(capital) FROM company; | Easy | 87806087.0 | [
"company"
] |
4 | List the basic cnpj of the companies with a capital below 1000 | SELECT basic_cnpj FROM company WHERE capital < 1000; | Easy | 13003307; 2031566; 4348741; 11774782; 7358688; 2873491; 23939025; 9037731; 20935870; 5228431; 22276844; 97154173; 93776896; 15318975; 63779334; 13866855; 1932535; 75958801; 65767980; 13244647; 12277301; 1902956; 7132536; 97087027; 1875060; 38752818; 5340872; 13772725; 33903363; 207354; 1344996; 6566241; 37260275; 18695... | [
"company"
] |
5 | What are the distinct states of the establishments | SELECT DISTINCT state FROM establishment; | Easy | BA; GO; MG; SC; RS; RJ; PR; SP; AC; PE; MT; CE; AL; PB; DF; SE; PA; RO; MA; TO; AM; RN; PI; ES; AP; MS; EX; RR | [
"establishment"
] |
6 | What is the name of each company with capital gratter than 1 million? | SELECT name FROM company WHERE capital > 1000000; | Easy | CONCEICAO FIT ACADEMIA DE GINASTICA E CONDICIONAMENTO FISICO LTDA; GEBB WORK INDUSTRIA DE MOVEIS LTDA; REECICLAR DO BRASIL LTDA; ENGIE TRADING COMERCIALIZADORA DE ENERGIA LTDA; RESERVA COLIBRIS SPE LTDA; EBI ECIA BUZIOS INCORPORACOES LTDA - EM LIQUIDACAO; FEMESC COMERCIO DE MATERIAL ESCOLAR E ESCRITORIO LTDA; PAX EMPRE... | [
"company"
] |
7 | What is the name of the companies with capital gratter than 1 million? | SELECT name FROM company WHERE capital > 1000000; | Easy | CONCEICAO FIT ACADEMIA DE GINASTICA E CONDICIONAMENTO FISICO LTDA; GEBB WORK INDUSTRIA DE MOVEIS LTDA; REECICLAR DO BRASIL LTDA; ENGIE TRADING COMERCIALIZADORA DE ENERGIA LTDA; RESERVA COLIBRIS SPE LTDA; EBI ECIA BUZIOS INCORPORACOES LTDA - EM LIQUIDACAO; FEMESC COMERCIO DE MATERIAL ESCOLAR E ESCRITORIO LTDA; PAX EMPRE... | [
"company"
] |
8 | What is the total capital for all companies? | SELECT SUM(capital) FROM company | Easy | 87806087.0 | [
"company"
] |
9 | What is the total capital for all companies with size code 3? | SELECT SUM(capital) FROM company WHERE company_size_code = 3; | Easy | 6026000.0 | [
"company"
] |
10 | List the basic cnpj of th establishments with '5612100' as primary economic activity code | SELECT basic_cnpj FROM establishment WHERE primary_economic_activity_code = 5612100; | Easy | 40010763; 18825347; 21085810; 33880625; 23971113; 37476156; 24133510; 28142097; 35662537; 14549079 | [
"establishment"
] |
11 | How many simple taxation was excluded between 2021-01-01 and 2022-12-31? | SELECT COUNT(*) FROM taxation WHERE simples_taxation_exclusion_date > 2021-01-01 AND simples_taxation_exclusion_date <2022-12-31; | Easy | 0 | [
"taxation"
] |
12 | What is the minimum and maximum capital of companies? | SELECT MIN(capital), MAX(capital) FROM company; | Easy | 0.0, 36000000.0 | [
"company"
] |
13 | What is the minimum and maximum capital of companies with size_code equal to 3? | SELECT MIN(capital), MAX(capital) FROM company WHERE company_size_code=3; | Easy | 0.0, 3000000.0 | [
"company"
] |
14 | Show the names and states of all establishments who have registration status code equal to 1 | SELECT name, state FROM establishment WHERE registration_status_code=1; | Easy | NIBA ELETRONICA, SP; None, PE | [
"establishment"
] |
15 | What is the highest number of a age range code?; | SELECT MAX(age_range_code) FROM age_range | Easy | 9 | [
"age_range"
] |
16 | List the basic cnpj of establishments with a name starting with 'S' | SELECT basic_cnpj FROM establishment WHERE name LIKE 'S%'; | Easy | 09518509; 24603935; 17876726; 01672396; 26949728; 07237287; 21123601; 23647289; 47391473; 30133972; 05862915; 01062023; 10762620; 18613843; 03602260; 04800673; 05320871; 07168317; 65848731; 21861583; 21427940; 21132658 | [
"establishment"
] |
17 | What is the basic cnpj of companies that have capital between 1000 and 10000? | SELECT basic_cnpj FROM company WHERE capital BETWEEN 1000 AND 10000; | Easy | 15605651; 23389598; 19540179; 52974497; 53694224; 38613993; 49051313; 34739822; 46167585; 36127465; 48191370; 24576055; 36367904; 41269038; 30159820; 51870663; 42404412; 11129790; 33363302; 48438957; 25241797; 52834012; 11416501; 26016573; 21500077; 49586906; 28801138; 28981450; 40851582; 23418028; 44934862; 53594504; ... | [
"company"
] |
18 | What is the firts start activity date for establishments that contain 'Y' in their name? | SELECT MIN(start_activity_date) FROM establishment WHERE name LIKE '%Y%'; | Easy | 1980-03-21 | [
"establishment"
] |
19 | What is the codes of the economic activities that contain 'Z' in their name? | SELECT economic_activity_code FROM economic_activity WHERE economic_activity_name LIKE '%Z%'; | Easy | 5611205; 9329899; 111301; 899102; 6492100; 4756300; 2449101; 9412000; 1340501; 4211102; 1061901; 2062200; 4649409; 2012600; 9609208; 5211701; 8230001; 2342702; 9529104; 4713002; 4752100; 4683400; 729404; 161001; 6202300; 4689399; 4679601; 3317102; 2013400; 8640205; 8640207; 2342701; 9103100; 2790202; 4213800; 9001906; ... | [
"economic_activity"
] |
20 | Display the names of cities with codes with codes less than 10 | SELECT city_name FROM city WHERE city_code < 10; | Easy | JI-PARANA; BURITIS; CUJUBIM; PORTO VELHO | [
"city"
] |
21 | List all unique primary economic activities codes of establishments in 'SP' state | SELECT DISTINCT primary_economic_activity_code FROM establishment WHERE state = 'SP'; | Easy | 7112000; 8650006; 5813100; 9602501; 4330499; 4399103; 7420003; 6920601; 8299707; 4789001; 121101; 4759801; 5611203; 9700500; 9312300; 5223100; 210101; 9602502; 4712100; 4751201; 4321500; 8888888; 8599699; 5250803; 4771701; 4781400; 4729699; 2593400; 3101200; 4520005; 6470101; 8219999; 4649408; 113000; 4722901; 9492800;... | [
"establishment"
] |
22 | Calculate the average capital of companies | SELECT AVG(capital) FROM company; | Easy | 87806.087 | [
"company"
] |
23 | Calculate the average capital in the 'company' table. | SELECT AVG(capital) FROM company; | Easy | 87806.087 | [
"company"
] |
24 | How many companies are registered | SELECT COUNT(*) FROM company; | Easy | 1000 | [
"company"
] |
25 | What are the description of the types of partners registered? | SELECT partner_type_description FROM partner_type; | Easy | PESSOA JURÍDICA; PESSOA FÍSICA; ESTRANGEIRO | [
"partner_type"
] |
26 | How many companies have a capital greater than 1 million? | SELECT COUNT(*) FROM company WHERE capital > 1000000; | Easy | 8 | [
"company"
] |
27 | List the basic cnpj of the companies that have a capital greater than 1 million reais? | SELECT basic_cnpj FROM company WHERE capital > 1000000; | Easy | 38252387; 9634476; 39881324; 31635668; 46670546; 40392706; 45364480; 9117176 | [
"company"
] |
28 | What is the description of the age range with code equal to 5? | SELECT age_range_description FROM age_range WHERE age_range_code = 5; | Easy | 41 a 50 anos | [
"age_range"
] |
29 | How many establishments have any secondary economic activity registered? | SELECT COUNT(*) FROM establishment WHERE secondary_economic_activity_code IS NOT NULL; | Easy | 440 | [
"establishment"
] |
30 | How many 'Main' establishments? | SELECT COUNT(*) FROM establishment WHERE main_or_branch = 'Main'; | Easy | 946 | [
"establishment"
] |
31 | What is the maximum capital of a company? | SELECT MAX(capital) FROM company; | Easy | 36000000.0 | [
"company"
] |
32 | What is the min date an establishment stated activity? | SELECT MIN(start_activity_date) FROM establishment; | Easy | 1966-06-30 | [
"establishment"
] |
33 | What is the earliest start activity date of a establishment? | SELECT MIN(start_activity_date) FROM establishment; | Easy | 1966-06-30 | [
"establishment"
] |
34 | What are the age ranges description and their respective codes? | SELECT age_range_description, age_range_code FROM age_range; | Easy | 0 a 12 anos, 1; 13 a 20 anos, 2; 21 a 30 anos, 3; 31 a 40 anos, 4; 41 a 50 anos, 5; 51 a 60 anos, 6; 61 a 70 anos, 7; 71 a 80 anos, 8; Maiores de 80 anos, 9; Não se aplica, 0 | [
"age_range"
] |
35 | List the the country names and their respective codes? | SELECT country_name, country_code FROM country; | Easy | NOVA ZELANDIA, 548; OMA, 556; GEORGIA, REPUBLICA DA, 291; GRANADA, 297; ALBORAN-PEREJIL,ILHAS, 20; Bahrein, Ilhas, 80; EMIRADOS ARABES UNIDOS, 244; GUADALUPE, 309; FIJI, 870; VIETNAME DO NORTE, 855; BRASIL (AFRETAMENTO), 106; HUNGRIA, 355; BURUNDI, 115; CANADA, 149; WALLIS E FUTURNA, ILHAS, 875; CATAR, 154; MALI, 464; ... | [
"country"
] |
36 | How many unique economic activities name exist? | SELECT COUNT(DISTINCT economic_activity_name) AS total_activities FROM economic_activity; | Easy | 998 | [
"economic_activity"
] |
37 | What is the name of company with the highest capital? | SELECT name FROM company ORDER BY capital DESC LIMIT 1; | Easy | ENGIE TRADING COMERCIALIZADORA DE ENERGIA LTDA | [
"company"
] |
38 | Which company size code have the lowest capital? | SELECT company_size_code FROM company ORDER BY capital ASC LIMIT 1; | Easy | 1 | [
"company"
] |
39 | What are the basic cnpj of the top 3 companies based on their capital? | SELECT basic_cnpj FROM company ORDER BY capital DESC LIMIT 3; | Easy | 31635668; 9117176; 38252387 | [
"company"
] |
40 | What is the average capital of companies by each size code, along with their respective size code? | SELECT company_size_code, AVG(capital) FROM company GROUP BY company_size_code; | Medium | 0, 0.0; 1, 15367.907539118065; 3, 177235.29411764705; 5, 271940.4137931034 | [
"company"
] |
41 | Calculate the average capital of companies by each size? | SELECT company_size_code, AVG(capital) FROM company GROUP BY company_size_code; | Medium | 0, 0.0; 1, 15367.907539118065; 3, 177235.29411764705; 5, 271940.4137931034 | [
"company"
] |
42 | How many unique primary activity code are in the establishment table for each state? | SELECT state, COUNT(DISTINCT primary_economic_activity_code) FROM establishment GROUP BY state; | Medium | AC, 3; AL, 13; AM, 9; AP, 5; BA, 36; CE, 20; DF, 15; ES, 21; EX, 3; GO, 28; MA, 21; MG, 75; MS, 10; MT, 17; PA, 21; PB, 15; PE, 20; PI, 5; PR, 55; RJ, 62; RN, 7; RO, 8; RR, 1; RS, 48; SC, 37; SE, 10; SP, 149; TO, 6 | [
"establishment"
] |
43 | How many unique primary activity code are in the establishment table for each state order by state ? | SELECT state, COUNT(DISTINCT primary_economic_activity_code) FROM establishment GROUP BY state ORDER BY state; | Medium | AC, 3; AL, 13; AM, 9; AP, 5; BA, 36; CE, 20; DF, 15; ES, 21; EX, 3; GO, 28; MA, 21; MG, 75; MS, 10; MT, 17; PA, 21; PB, 15; PE, 20; PI, 5; PR, 55; RJ, 62; RN, 7; RO, 8; RR, 1; RS, 48; SC, 37; SE, 10; SP, 149; TO, 6 | [
"establishment"
] |
44 | Exists how many companies in each company size code? | SELECT company_size_code, COUNT(*) AS total_companies FROM company GROUP BY company_size_code; | Medium | 0, 2; 1, 703; 3, 34; 5, 261 | [
"company"
] |
45 | What are the top 5 states with the highest number of establishments with their respective number of establishments? | SELECT state, COUNT(*) FROM establishment GROUP BY state ORDER BY COUNT(*) DESC LIMIT 5; | Medium | SP, 280; MG, 112; RJ, 81; PR, 74; RS, 67 | [
"establishment"
] |
46 | How many establishments are located in each state? | SELECT state, COUNT(*) AS total_establishments FROM establishment GROUP BY state; | Medium | AC, 3; AL, 13; AM, 10; AP, 5; BA, 53; CE, 25; DF, 16; ES, 22; EX, 3; GO, 34; MA, 22; MG, 112; MS, 10; MT, 17; PA, 24; PB, 16; PE, 23; PI, 5; PR, 74; RJ, 81; RN, 8; RO, 9; RR, 1; RS, 67; SC, 44; SE, 16; SP, 280; TO, 7 | [
"establishment"
] |
47 | What is the total capital for all companies whith size description 'MICRO EMPRESA'? | SELECT SUM(company.capital) FROM company JOIN company_size ON company.company_size_code = company_size.company_size_code WHERE company_size_description = 'MICRO EMPRESA'; | Hard | 10803639.0 | [
"company",
"company_size"
] |
48 | How many establishments have 'Serviços de engenharia' as primary economic activity? | SELECT COUNT(*) FROM establishment e JOIN economic_activity ea ON e.primary_economic_activity_code = ea.economic_activity_code WHERE ea.economic_activity_name = 'Serviços de engenharia'; | Hard | 6 | [
"establishment",
"economic_activity"
] |
49 | What is the size descripition of the company with the highest capital? | SELECT company_size.company_size_description FROM company JOIN company_size ON company.company_size_code = company_size.company_size_code ORDER BY company.capital DESC LIMIT 1; | Hard | DEMAIS | [
"company",
"company_size"
] |
50 | List all establishments basic cnpj and their corresponding registration status description | SELECT establishment.basic_cnpj, registration_status.registration_status_description FROM establishment JOIN registration_status ON establishment.registration_status_code = registration_status.registration_status_code | Hard | 40515767, ATIVA; 40010763, INAPTA; 23205297, BAIXADA; 84307404, BAIXADA; 22665599, ATIVA; 20215350, BAIXADA; 28336615, INAPTA; 21216767, ATIVA; 41099960, BAIXADA; 09518509, ATIVA; 11260448, INAPTA; 04567405, ATIVA; 53385523, ATIVA; 13812166, BAIXADA; 22086918, ATIVA; 04518353, BAIXADA; 05267871, INAPTA; 51465376, ATIVA... | [
"establishment",
"registration_status"
] |
51 | Identify tha basic cnpj of companies with option for both simples and mei taxation | SELECT DISTINCT company.basic_cnpj FROM company JOIN taxation ON company.basic_cnpj = taxation.basic_cnpj WHERE taxation.option_for_simples_taxation = 'S' AND taxation.option_for_mei_taxation = 'S'; | Hard | Nenhum resultado encontrado. | [
"company",
"taxation"
] |
52 | What are the unique names of the countries where the registered establishments are located? | SELECT DISTINCT c.country_name FROM establishment AS e JOIN country AS c ON e.country_code = c.country_code; | Hard | BRASIL; REINO UNIDO; PORTUGAL | [
"establishment",
"country"
] |
53 | List the name of the most frequent primary economic activity? | SELECT a.economic_activity_name FROM establishment AS e JOIN economic_activity AS a ON e.primary_economic_activity_code = a.economic_activity_code GROUP BY a.economic_activity_name ORDER BY COUNT(*) DESC LIMIT 1; | Hard | Atividade Econônica não informada | [
"establishment",
"economic_activity"
] |
54 | What is the name of the city that has more establishments? | SELECT c.city_name FROM establishment AS e JOIN city AS c ON e.city_code = c.city_code GROUP BY c.city_name ORDER BY COUNT(*) DESC LIMIT 1; | Hard | BRASILIA | [
"establishment",
"city"
] |
55 | What are the name of the top 5 cities by quantity of establishments? | SELECT c.city_name FROM establishment e JOIN city c ON e.city_code = c.city_code GROUP BY c.city_name ORDER BY COUNT(*) DESC LIMIT 5; | Hard | BRASILIA; PORTO ALEGRE; JUIZ DE FORA; BELEM; VILA VELHA | [
"establishment",
"city"
] |
56 | What are the names of the countries where the registered establishments are located, along with their respective quantity of establishments. | SELECT c.country_name, COUNT(*) FROM establishment AS e JOIN country AS c ON e.country_code = c.country_code GROUP BY c.country_code; | Hard | BRASIL, 13; PORTUGAL, 1; REINO UNIDO, 2 | [
"establishment",
"country"
] |
57 | What are the description of the types of partners with more than 10 partners? | SELECT pt.partner_type_description FROM partner AS p JOIN partner_type AS pt ON p.partner_type_code = pt.partner_type_code GROUP BY p.partner_type_code HAVING COUNT(*) > 10; | Hard | PESSOA JURÍDICA; PESSOA FÍSICA | [
"partner",
"partner_type"
] |
58 | What is the age range description and the number of partners for each age range? | SELECT ar.age_range_description, COUNT(p.partner_age_range_code) AS partner_count FROM partner AS p JOIN age_range AS ar ON p.partner_age_range_code = ar.age_range_code GROUP BY ar.age_range_description; | Hard | 0 a 12 anos, 1; 13 a 20 anos, 7; 21 a 30 anos, 72; 31 a 40 anos, 165; 41 a 50 anos, 259; 51 a 60 anos, 224; 61 a 70 anos, 123; 71 a 80 anos, 85; Maiores de 80 anos, 42; Não se aplica, 22 | [
"partner",
"age_range"
] |
59 | Show the name of the coutry with more establishments | SELECT p.country_name FROM establishment AS e JOIN country AS p ON e.country_code = p.country_code GROUP BY p.country_name ORDER BY COUNT(*) DESC LIMIT 1; | Hard | BRASIL | [
"establishment",
"country"
] |
60 | What is the registration status description of the establishment with basic CNPJ equal to '33201893'? | SELECT rs.registration_status_description FROM establishment AS e JOIN registration_status AS rs ON e.registration_status_code = rs.registration_status_code WHERE e.basic_cnpj = '33201893'; | Hard | INAPTA | [
"establishment",
"registration_status"
] |
README.md exists but content is empty.
- Downloads last month
- 15