id
int64
1
110
question
stringlengths
31
140
possible_query
stringlengths
29
217
complexity
stringclasses
4 values
answer
stringlengths
1
23.1k
required_tables
listlengths
1
2
1
List all establishments for the 'RN' state in the 'establishment' table.
SELECT * FROM establishment WHERE state = 'RN';
basic
27817200, 0001, Main, DROGA MED, 4772500, RN, 2, None, 1759, 2017-05-25, 4771701; 32859505, 0001, Main, None, 8630502, RN, 2, None, 1603, 2019-02-22, 8630503; 32999742, 0001, Main, OLIVEIRA - CURSOS E ASSESSORIA, 8599605,8230001,8599699,8219999,5819100, RN, 8, None, 1899, 2019-03-12, 8599604; 04087496, 0002, Branch, No...
[ "establishment" ]
2
List all establishments located in the 'RN' state
SELECT * FROM establishment WHERE state = 'RN';
basic
27817200, 0001, Main, DROGA MED, 4772500, RN, 2, None, 1759, 2017-05-25, 4771701; 32859505, 0001, Main, None, 8630502, RN, 2, None, 1603, 2019-02-22, 8630503; 32999742, 0001, Main, OLIVEIRA - CURSOS E ASSESSORIA, 8599605,8230001,8599699,8219999,5819100, RN, 8, None, 1899, 2019-03-12, 8599604; 04087496, 0002, Branch, No...
[ "establishment" ]
3
List basic cnpj for the 'RN' state in the 'establishment' table.
SELECT basic_cnpj FROM establishment WHERE state = 'RN';
basic
27817200; 32859505; 32999742; 04087496; 24191952; 38530104; 33169122; 38226259
[ "establishment" ]
4
What are the states of all branch establishments?
SELECT state FROM establishment WHERE main_or_branch = 'Branch';
basic
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" ]
5
Show the basic cnpj and states of all 'Branch' establishments
SELECT basic_cnpj, state FROM establishment WHERE main_or_branch = 'Branch';
basic
24603935, SP; 91579656, RS; 47508411, SP; 09372554, CE; 03559237, TO; 14324141, MA; 20450277, MG; 07745748, MA; 08331015, SP; 14669881, RJ; 08100606, SP; 75074443, PR; 04168811, AM; 61088696, SP; 37787172, ES; 11316876, PR; 08373266, SP; 08262077, SP; 37594389, GO; 73303430, CE; 32593847, RS; 02223966, SP; 33014556, PA...
[ "establishment" ]
6
What is the total capital content in the company table?
SELECT SUM(capital) FROM company;
basic
87806087.0
[ "company" ]
7
What is the total capital in the company table?
SELECT SUM(capital) FROM company;
basic
87806087.0
[ "company" ]
8
What is the total capital from all companies?
SELECT SUM(capital) FROM company;
basic
87806087.0
[ "company" ]
9
Display all companies with a capital below 1000, along with their respective capital.
SELECT name, capital FROM company WHERE capital < 1000;
basic
ROSILENE PEDRO DE SOUZA 04320775619, 1.0; BYBLOS ASSESSORIA E CONSULTORIA LTDA, 0.0; SILVA & SATO LTDA, 0.0; PEDRO LUIS FRAGA GRUNE 67609139068, 1.0; VALDECIR VELOSO, 0.0; MED-LAB CONVENIOS S/C LTDA, 0.0; CLEUZA DE FATIMA PERES DE SOUZA E OUTROS, 0.0; GERALDO ALEXANDRE CASAGRANDE FILHO, 0.0; J M SERVICOS GERAIS LTDA, 0...
[ "company" ]
10
List the name of the companies with a capital below 1000, along with their respective capital.
SELECT name, capital FROM company WHERE capital < 1000;
basic
ROSILENE PEDRO DE SOUZA 04320775619, 1.0; BYBLOS ASSESSORIA E CONSULTORIA LTDA, 0.0; SILVA & SATO LTDA, 0.0; PEDRO LUIS FRAGA GRUNE 67609139068, 1.0; VALDECIR VELOSO, 0.0; MED-LAB CONVENIOS S/C LTDA, 0.0; CLEUZA DE FATIMA PERES DE SOUZA E OUTROS, 0.0; GERALDO ALEXANDRE CASAGRANDE FILHO, 0.0; J M SERVICOS GERAIS LTDA, 0...
[ "company" ]
11
List the basic cnpj of the companies with a capital below 1000
SELECT basic_cnpj FROM company WHERE capital < 1000;
basic
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" ]
12
What are the states of the establishments
SELECT DISTINCT state FROM establishment;
basic
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" ]
13
What is the name and capital of each company with capital gratter than 1000000?
SELECT name,capital FROM company WHERE capital > 1000000;
basic
CONCEICAO FIT ACADEMIA DE GINASTICA E CONDICIONAMENTO FISICO LTDA, 6000000.0; GEBB WORK INDUSTRIA DE MOVEIS LTDA, 5000000.0; REECICLAR DO BRASIL LTDA, 1132462.0; ENGIE TRADING COMERCIALIZADORA DE ENERGIA LTDA, 36000000.0; RESERVA COLIBRIS SPE LTDA, 2400000.0; EBI ECIA BUZIOS INCORPORACOES LTDA - EM LIQUIDACAO, 4956822....
[ "company" ]
14
What is the name and capital of each company with capital gratter than 1 million?
SELECT name,capital FROM company WHERE capital > 1000000;
basic
CONCEICAO FIT ACADEMIA DE GINASTICA E CONDICIONAMENTO FISICO LTDA, 6000000.0; GEBB WORK INDUSTRIA DE MOVEIS LTDA, 5000000.0; REECICLAR DO BRASIL LTDA, 1132462.0; ENGIE TRADING COMERCIALIZADORA DE ENERGIA LTDA, 36000000.0; RESERVA COLIBRIS SPE LTDA, 2400000.0; EBI ECIA BUZIOS INCORPORACOES LTDA - EM LIQUIDACAO, 4956822....
[ "company" ]
15
Find all companies whith capital over $1,000,000
SELECT * FROM company WHERE capital > 1000000;
basic
CONCEICAO FIT ACADEMIA DE GINASTICA E CONDICIONAMENTO FISICO LTDA, 38252387, 6000000.0, 5; GEBB WORK INDUSTRIA DE MOVEIS LTDA, 9634476, 5000000.0, 5; REECICLAR DO BRASIL LTDA, 39881324, 1132462.0, 5; ENGIE TRADING COMERCIALIZADORA DE ENERGIA LTDA, 31635668, 36000000.0, 5; RESERVA COLIBRIS SPE LTDA, 46670546, 2400000.0,...
[ "company" ]
16
Find the companies with a capital above 1 million and their associated size code?
SELECT name,company_size_code FROM company WHERE capital > 1000000;
basic
CONCEICAO FIT ACADEMIA DE GINASTICA E CONDICIONAMENTO FISICO LTDA, 5; GEBB WORK INDUSTRIA DE MOVEIS LTDA, 5; REECICLAR DO BRASIL LTDA, 5; ENGIE TRADING COMERCIALIZADORA DE ENERGIA LTDA, 5; RESERVA COLIBRIS SPE LTDA, 5; EBI ECIA BUZIOS INCORPORACOES LTDA - EM LIQUIDACAO, 5; FEMESC COMERCIO DE MATERIAL ESCOLAR E ESCRITOR...
[ "company" ]
17
Find the companies with a capital above 1000000 and their associated size code?
SELECT name,company_size_code FROM company WHERE capital > 1000000;
basic
CONCEICAO FIT ACADEMIA DE GINASTICA E CONDICIONAMENTO FISICO LTDA, 5; GEBB WORK INDUSTRIA DE MOVEIS LTDA, 5; REECICLAR DO BRASIL LTDA, 5; ENGIE TRADING COMERCIALIZADORA DE ENERGIA LTDA, 5; RESERVA COLIBRIS SPE LTDA, 5; EBI ECIA BUZIOS INCORPORACOES LTDA - EM LIQUIDACAO, 5; FEMESC COMERCIO DE MATERIAL ESCOLAR E ESCRITOR...
[ "company" ]
18
What is the total capital for all companies?
SELECT SUM(capital) FROM company
basic
87806087.0
[ "company" ]
19
What is the total capital for all companies with size code 3?
SELECT SUM(capital) FROM company WHERE company_size_code = 3;
basic
6026000.0
[ "company" ]
20
List all establishments with 5612100 as primary economic activity code
SELECT * FROM establishment WHERE primary_economic_activity_code = 5612100;
basic
40010763, 0001, Main, None, None, GO, 4, None, 9373, 2020-12-03, 5612100; 18825347, 0001, Main, None, None, GO, 4, None, 9373, 2013-09-06, 5612100; 21085810, 0001, Main, NS VITAL, 4789099,4723700,4744001, GO, 8, None, 9227, 2014-09-22, 5612100; 33880625, 0001, Main, None, 4789002,4789099,4723700,4721103,7319002,4713002...
[ "establishment" ]
21
How many simple taxation was excluded between 2021 and 2022?
SELECT COUNT(*) FROM taxation WHERE simples_taxation_exclusion_date > 2021-01-01 AND simples_taxation_exclusion_date <2022-12-31;
basic
0
[ "taxation" ]
22
What is the minimum and maximum capital of companies?
SELECT MIN(capital), MAX(capital) FROM company;
basic
0.0, 36000000.0
[ "company" ]
23
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;
basic
0.0, 3000000.0
[ "company" ]
24
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;
basic
NIBA ELETRONICA, SP; None, PE
[ "establishment" ]
25
What is the highest number of capital recieved by a company?;
SELECT MAX(capital) FROM company
basic
36000000.0
[ "company" ]
26
What is the highest number of a code by primary economic activity?;
SELECT MAX(primary_economic_activity_code) FROM establishment
basic
9700500
[ "establishment" ]
27
What is the highest number of a age range code?;
SELECT MAX(age_range_code) FROM age_range
basic
9
[ "age_range" ]
28
List all establishments with a name starting with 'S'
SELECT * FROM establishment WHERE name LIKE 'S%';
basic
09518509, 0001, Main, SUPORTE SMART GO LARANJEIRAS RIO DE JANEIRO, 4751201,5320201,9511800,9512600, RJ, 2, None, 6001, 2008-04-09, 4752100; 24603935, 0002, Branch, SANTOS COSTA ASSESSORIA CONTABIL, None, SP, 8, None, 7107, 2016-06-15, 6920601; 17876726, 0001, Main, SILOCIANO VIRTUAL, 4789003,4752100,4762800,7319002,581...
[ "establishment" ]
29
List all coutrys with a name starting with 'C'
SELECT * FROM country WHERE country_name LIKE 'C%';
basic
CANADA, 149; CATAR, 154; CAMAROES, 145; COCOS (KEELING),ILHAS, 165; COMORES, ILHAS, 173; CINGAPURA, 741; China, República Popular, 160; CASAQUISTAO, REPUBLICA DO, 153; COLIS POSTAUX, 0; CONGO, 177; Christmas,Ilhas (Navidad), 511; CHILE, 158; CACHEMIRA, 131; COSTA DO MARFIM, 193; COVEITE, 198; Cabo Verde,República de, 1...
[ "country" ]
30
Which companies have capital between 1000 and 10000?
SELECT * FROM company WHERE capital BETWEEN 1000 AND 10000;
basic
RAIMUNDO NONATO CARDOSO 48031968187, 15605651, 1000.0, 1; SIMONE APARECIDA NUNES LORENA ANTONELLI 11247501850, 23389598, 1000.0, 1; CLOVIS BORGHARDT 01494327201, 19540179, 1500.0, 1; 52.974.497 CAROLINA DA SILVA PINA, 52974497, 5000.0, 1; 53.694.224 DENIZE STEFANE DE CAMPOS SOUSA, 53694224, 1000.0, 1; TATIANA DE FRANCA...
[ "company" ]
31
What is the earliest start activity date for establishments that contain 'Y' in their name?
SELECT MIN(start_activity_date) FROM establishment WHERE name LIKE '%Y%';
basic
1980-03-21
[ "establishment" ]
32
What is the economic activities that contain 'Z' in their name?
SELECT * FROM economic_activity WHERE economic_activity_name LIKE '%Z%';
basic
Bares e outros estabelecimentos especializados em servir bebidas, com entretenimento, 5611205; Outras atividades de recreação e lazer não especificadas anteriormente, 9329899; Cultivo de arroz, 111301; Extração de quartzo, 899102; Securitização de créditos, 6492100; Comércio varejista especializado de instrumentos musi...
[ "economic_activity" ]
33
Display the codes and names of cities with codes with codes less than 10
SELECT city_code, city_name FROM city WHERE city_code < 10;
basic
5, JI-PARANA; 4, BURITIS; 8, CUJUBIM; 3, PORTO VELHO
[ "city" ]
34
List all unique primary economic activities codes of establishments in 'SP' state
SELECT DISTINCT primary_economic_activity_code FROM establishment WHERE state = 'SP';
basic
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" ]
35
Calculate the average capital of companies?
SELECT AVG(capital) FROM company;
basic
87806.087
[ "company" ]
36
What is the average capital of registered companies?
SELECT AVG(capital) FROM company;
basic
87806.087
[ "company" ]
37
How many countries are registered?
SELECT COUNT(*) FROM country;
basic
256
[ "country" ]
38
How many companies are registered
SELECT COUNT(*) FROM company;
basic
1000
[ "company" ]
39
How many companies are registered in the system?
SELECT COUNT(*) FROM company;
basic
1000
[ "company" ]
40
What are the description of the types of partners registered?
SELECT partner_type_description FROM partner_type;
basic
PESSOA JURÍDICA; PESSOA FÍSICA; ESTRANGEIRO
[ "partner_type" ]
41
How many companies have a capital of more than 1000000?
SELECT COUNT(*) FROM company WHERE capital > 1000000;
basic
8
[ "company" ]
42
How many companies have a capital greater than 1 million?
SELECT COUNT(*) FROM company WHERE capital > 1000000;
basic
8
[ "company" ]
43
List the basic cnpj number of the companies that have a capital greater than 1 million reais?
SELECT basic_cnpj FROM company WHERE capital > 1000000;
basic
38252387; 9634476; 39881324; 31635668; 46670546; 40392706; 45364480; 9117176
[ "company" ]
44
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;
basic
41 a 50 anos
[ "age_range" ]
45
How many establishments have any secondary economic activity registered?
SELECT COUNT(*) FROM establishment WHERE secondary_economic_activity_code IS NOT NULL;
basic
440
[ "establishment" ]
46
How many establishments has secondary economic activity?
SELECT COUNT(*) FROM establishment WHERE secondary_economic_activity_code IS NOT NULL;
basic
440
[ "establishment" ]
47
How many companies are opted for the simples taxation?
SELECT COUNT(*) FROM taxation WHERE option_for_simples_taxation = 'S';
basic
573
[ "taxation" ]
48
How many establishments are registered as 'Main'?
SELECT COUNT(*) FROM establishment WHERE main_or_branch = 'Main';
basic
946
[ "establishment" ]
49
How many 'Main' establishments?
SELECT COUNT(*) FROM establishment WHERE main_or_branch = 'Main';
basic
946
[ "establishment" ]
50
How many establishments have main_or_branch='Main'?
SELECT COUNT(*) FROM establishment WHERE main_or_branch = 'Main';
basic
946
[ "establishment" ]
51
What is the maximum capital received by a company?
SELECT MAX(capital) FROM company;
basic
36000000.0
[ "company" ]
52
What is the min date an establishment stated activity?
SELECT MIN(start_activity_date) FROM establishment;
basic
1966-06-30
[ "establishment" ]
53
When the first establishment stated activity?
SELECT MIN(start_activity_date) FROM establishment;
basic
1966-06-30
[ "establishment" ]
54
What is the earliest start activity date in the establishment table?
SELECT MIN(start_activity_date) FROM establishment;
basic
1966-06-30
[ "establishment" ]
55
What are the age ranges and their respective codes?
SELECT age_range_description, age_range_code FROM age_range;
basic
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" ]
56
What are the age ranges description and their respective codes?
SELECT age_range_description, age_range_code FROM age_range;
basic
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" ]
57
List the age ranges and their respective codes.
SELECT age_range_description, age_range_code FROM age_range;
basic
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" ]
58
What are the countries and their respective codes?
SELECT country_name, country_code FROM country;
basic
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" ]
59
How many distinct economic activities name exist?
SELECT COUNT(DISTINCT economic_activity_name) AS total_activities FROM economic_activity;
basic
998
[ "economic_activity" ]
60
How many unique economic activities name exist?
SELECT COUNT(DISTINCT economic_activity_name) AS total_activities FROM economic_activity;
basic
998
[ "economic_activity" ]
61
What is the company with the lowest capital?
SELECT name FROM company ORDER BY capital ASC LIMIT 1;
basic
BYBLOS ASSESSORIA E CONSULTORIA LTDA
[ "company" ]
62
What is the basic cnpj of the company with the lowest capital?
SELECT basic_cnpj FROM company ORDER BY capital ASC LIMIT 1;
basic
2031566
[ "company" ]
63
What is the basic cnpj and the capital of the company with the lowest capital?
SELECT basic_cnpj, capital FROM company ORDER BY capital ASC LIMIT 1;
basic
2031566, 0.0
[ "company" ]
64
Which company size code have the highest capital?
SELECT company_size_code FROM company ORDER BY capital DESC LIMIT 1;
basic
5
[ "company" ]
65
What are the top 3 companies based on the capital?
SELECT * FROM company ORDER BY capital DESC LIMIT 3;
basic
ENGIE TRADING COMERCIALIZADORA DE ENERGIA LTDA, 31635668, 36000000.0, 5; PAX EMPREENDIMENTOS E PARTICIPACOES S.A., 9117176, 11460000.0, 5; CONCEICAO FIT ACADEMIA DE GINASTICA E CONDICIONAMENTO FISICO LTDA, 38252387, 6000000.0, 5
[ "company" ]
66
Show me the top 3 companies based on the capital?
SELECT * FROM company ORDER BY capital DESC LIMIT 3;
basic
ENGIE TRADING COMERCIALIZADORA DE ENERGIA LTDA, 31635668, 36000000.0, 5; PAX EMPREENDIMENTOS E PARTICIPACOES S.A., 9117176, 11460000.0, 5; CONCEICAO FIT ACADEMIA DE GINASTICA E CONDICIONAMENTO FISICO LTDA, 38252387, 6000000.0, 5
[ "company" ]
67
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;
aggregation
0, 0.0; 1, 15367.907539118065; 3, 177235.29411764705; 5, 271940.4137931034
[ "company" ]
68
What is the average capital of companies by each size?
SELECT AVG(capital) FROM company GROUP BY company_size_code;
aggregation
0.0; 15367.907539118065; 177235.29411764705; 271940.4137931034
[ "company" ]
69
Calculate the average capital of companies by each size?
SELECT AVG(capital) FROM company GROUP BY company_size_code;
aggregation
0.0; 15367.907539118065; 177235.29411764705; 271940.4137931034
[ "company" ]
70
How many is the average capital of companies by each size?
SELECT AVG(capital) FROM company GROUP BY company_size_code;
aggregation
0.0; 15367.907539118065; 177235.29411764705; 271940.4137931034
[ "company" ]
71
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;
aggregation
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" ]
72
What is the most recent start activity date for each establishment in the 'RJ' state, ordered by start activity date?
SELECT state, MAX(start_activity_date) FROM establishment GROUP BY state ORDER BY start_activity_date;
aggregation
RR, 1984-12-13; AC, 2013-06-12; EX, 2014-04-24; RN, 2020-09-17; MS, 2020-09-24; TO, 2020-09-25; AM, 2022-01-21; AL, 2022-08-18; PE, 2022-09-29; PI, 2023-01-24; PB, 2023-01-31; GO, 2023-02-28; CE, 2023-05-18; PA, 2023-06-14; ES, 2023-06-28; MT, 2023-07-26; AP, 2023-08-03; RS, 2023-09-05; RO, 2023-10-31; MA, 2023-11-10; ...
[ "establishment" ]
73
How many companies are registered in each company size code?
SELECT company_size_code, COUNT(*) AS total_companies FROM company GROUP BY company_size_code;
aggregation
0, 2; 1, 703; 3, 34; 5, 261
[ "company" ]
74
Exists how many companies in each company size code?
SELECT company_size_code, COUNT(*) AS total_companies FROM company GROUP BY company_size_code;
aggregation
0, 2; 1, 703; 3, 34; 5, 261
[ "company" ]
75
List the amount of companies in each company size code?
SELECT company_size_code, COUNT(*) AS total_companies FROM company GROUP BY company_size_code;
aggregation
0, 2; 1, 703; 3, 34; 5, 261
[ "company" ]
76
List the total of companies in each company size code?
SELECT company_size_code, COUNT(*) AS total_companies FROM company GROUP BY company_size_code;
aggregation
0, 2; 1, 703; 3, 34; 5, 261
[ "company" ]
77
What are the top 5 states by total amount of establishments?
SELECT state FROM establishment GROUP BY state ORDER BY COUNT(*) DESC LIMIT 5;
aggregation
SP; MG; RJ; PR; RS
[ "establishment" ]
78
What are the top 5 states with the highest number of establishments?
SELECT state FROM establishment GROUP BY state ORDER BY COUNT(*) DESC LIMIT 5;
aggregation
SP; MG; RJ; PR; RS
[ "establishment" ]
79
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;
aggregation
SP, 280; MG, 112; RJ, 81; PR, 74; RS, 67
[ "establishment" ]
80
How many establishments are located in each state?
SELECT state, COUNT(*) AS total_establishments FROM establishment GROUP BY state;
aggregation
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" ]
81
How many establishments by state?
SELECT state, COUNT(*) AS total_establishments FROM establishment GROUP BY state;
aggregation
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" ]
82
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';
single JOIN
10803639.0
[ "company", "company_size" ]
83
List all establishments whith 'Serviços de engenharia' as primary economic activity
SELECT * FROM establishment JOIN economic_activity ON establishment.primary_economic_activity_code = economic_activity.economic_activity_code WHERE economic_activity_name = 'Serviços de engenharia';
single JOIN
00913164, 0001, Main, None, None, BA, 4, None, 3685, 1995-11-14, 7112000, Serviços de engenharia, 7112000; 08015719, 0001, Main, None, None, MG, 2, None, 4123, 2006-05-09, 7112000, Serviços de engenharia, 7112000; 13812166, 0001, Main, None, 7111100, SP, 8, None, 7047, 2011-06-02, 7112000, Serviços de engenharia, 71120...
[ "establishment", "economic_activity" ]
84
How many establishments have 'Serviços de engenharia' as their 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';
single JOIN
6
[ "establishment", "economic_activity" ]
85
What is the basic cnpj and the size descripition of the company with the highest capital?
SELECT company.basic_cnpj, 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;
single JOIN
31635668, DEMAIS
[ "company", "company_size" ]
86
List all establishments basic cnpj and theis 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
single JOIN
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" ]
87
Identify 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';
single JOIN
Nenhum resultado encontrado.
[ "company", "taxation" ]
88
What are the 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;
single JOIN
BRASIL; REINO UNIDO; PORTUGAL
[ "establishment", "country" ]
89
Which age range code have more than 30 partners and what are their descriptions?
SELECT age_range.age_range_code, age_range.age_range_description FROM partner JOIN age_range ON partner.partner_age_range_code == age_range.age_range_code GROUP BY partner.partner_age_range_code HAVING COUNT(*) > 30;
single JOIN + aggregation
3, 21 a 30 anos; 4, 31 a 40 anos; 5, 41 a 50 anos; 6, 51 a 60 anos; 7, 61 a 70 anos; 8, 71 a 80 anos; 9, Maiores de 80 anos
[ "partner", "age_range" ]
90
What is the name of the most frequent economic activity as the primary economic activity of registered establishments?
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;
single JOIN + aggregation
Atividade Econônica não informada
[ "establishment", "economic_activity" ]
91
What is the economic activity more frequent as 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;
single JOIN + aggregation
Atividade Econônica não informada
[ "establishment", "economic_activity" ]
92
List the economic activity more frequent as 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;
single JOIN + aggregation
Atividade Econônica não informada
[ "establishment", "economic_activity" ]
93
What is 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;
single JOIN + aggregation
Atividade Econônica não informada
[ "establishment", "economic_activity" ]
94
List 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;
single JOIN + aggregation
Atividade Econônica não informada
[ "establishment", "economic_activity" ]
95
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;
single JOIN + aggregation
Atividade Econônica não informada
[ "establishment", "economic_activity" ]
96
What is the name of the city with the highest number of registered 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;
single JOIN + aggregation
BRASILIA
[ "establishment", "city" ]
97
What is the name of the city with 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;
single JOIN + aggregation
BRASILIA
[ "establishment", "city" ]
98
What city 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;
single JOIN + aggregation
BRASILIA
[ "establishment", "city" ]
99
What are the names of the top 5 cities by total amont 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;
single JOIN + aggregation
BRASILIA; PORTO ALEGRE; JUIZ DE FORA; BELEM; VILA VELHA
[ "establishment", "city" ]
100
What are the top 5 cities by total amont 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;
single JOIN + aggregation
BRASILIA; PORTO ALEGRE; JUIZ DE FORA; BELEM; VILA VELHA
[ "establishment", "city" ]