aherntech/sparc huggingface dataset:
Database: news_report
Question sequence:
Show me all the journalist information for each journalist!
What events have they each reported on.
Count how many each journalist has worked on.
Show me just the names of the journalists that have reported on more than 1!
SQL query sequence:
SELECT * FROM journalist
SELECT * FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID  =  T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID  =  T3.journalist_ID
SELECT T3.name, count(*) FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID  =  T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID  =  T3.journalist_ID group by T3.name
SELECT T3.Name FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID  =  T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID  =  T3.journalist_ID GROUP BY T3.Name HAVING COUNT(*)  >  1
Final question: Show the names of journalists that have reported more than one event.
Final SQL: SELECT T3.Name FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID  =  T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID  =  T3.journalist_ID GROUP BY T3.Name HAVING COUNT(*)  >  1
Database: news_report
Question sequence:
How many events have each journalists reported on?
How many journalists have 0 events!
What are their names?
SQL query sequence:
SELECT T3.name, count(*) FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID  =  T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID  =  T3.journalist_ID group by T3.name
SELECT count(*) FROM journalist WHERE journalist_ID NOT IN (SELECT journalist_ID FROM news_report)
SELECT Name FROM journalist WHERE journalist_ID NOT IN (SELECT journalist_ID FROM news_report)
Final question: List the names of journalists who have not reported any event.
Final SQL: SELECT Name FROM journalist WHERE journalist_ID NOT IN (SELECT journalist_ID FROM news_report)
Database: news_report
Question sequence:
List all the names of the events!
Show many attended each one!
What is the average event _attendance?
Also show the max!
SQL query sequence:
SELECT name FROM event
SELECT name, event_attendance FROM event
SELECT avg(event_attendance) FROM event
SELECT avg(Event_Attendance) ,  max(Event_Attendance) FROM event
Final question: what are the average and maximum attendances of all events?
Final SQL: SELECT avg(Event_Attendance) ,  max(Event_Attendance) FROM event
Database: news_report
Question sequence:
What are the different work_types of news reporting?
How many reporters belong to each type?
What is the average age of the reporters for each type?
Also show the average number of years working for each type?
SQL query sequence:
SELECT distinct work_type FROM news_report
SELECT count(*), t2.work_type FROM journalist AS t1 JOIN news_report AS t2 ON t1.journalist_id  =  t2.journalist_id group by t2.work_type
SELECT avg(t1.age), t2.work_type FROM journalist AS t1 JOIN news_report AS t2 ON t1.journalist_id  =  t2.journalist_id GROUP BY t2.work_type
SELECT avg(t1.age) ,  avg(Years_working) ,  t2.work_type FROM journalist AS t1 JOIN news_report AS t2 ON t1.journalist_id  =  t2.journalist_id GROUP BY t2.work_type
Final question: Find the average age and experience working length of journalists working on different role type.
Final SQL: SELECT avg(t1.age) ,  avg(Years_working) ,  t2.work_type FROM journalist AS t1 JOIN news_report AS t2 ON t1.journalist_id  =  t2.journalist_id GROUP BY t2.work_type
Database: storm_record
Question sequence:
What are the names of the regions?
Show all region code and region name sorted by the region name alphabetically.
Order the result by the codes.
SQL query sequence:
SELECT region_name FROM region;
SELECT region_code ,  region_name FROM region ORDER BY region_name ASC;
SELECT region_code ,  region_name FROM region ORDER BY region_code;
Final question: Show all region code and region name sorted by the codes.
Final SQL: SELECT region_code ,  region_name FROM region ORDER BY region_code;
Database: storm_record
Question sequence:
How about their names of each region?
Order the result in alphabetical order.
SQL query sequence:
SELECT region_name FROM region;
SELECT region_name FROM region ORDER BY region_name;
Final question: List all region names in alphabetical order.
Final SQL: SELECT region_name FROM region ORDER BY region_name;
Database: storm_record
Question sequence:
Can you list the id of region named Denmark.
How about the region code for all regions except for Denmark.
List their names.
SQL query sequence:
SELECT region_id FROM region WHERE region_name = 'Denmark';
SELECT region_code FROM region WHERE region_name != 'Denmark';
SELECT region_name FROM region WHERE region_name != 'Denmark';
Final question: Show names for all regions except for Denmark.
Final SQL: SELECT region_name FROM region WHERE region_name != 'Denmark';
Database: storm_record
Question sequence:
What's the number of deaths for each storm?
Show the average number of deaths.
How many storms had death records?
SQL query sequence:
SELECT Number_Deaths FROM storm;
SELECT avg(Number_Deaths) FROM storm;
SELECT count(*) FROM storm WHERE Number_Deaths  >  0;
Final question: How many storms had death records?
Final SQL: SELECT count(*) FROM storm WHERE Number_Deaths  >  0;
Database: storm_record
Question sequence:
Show me the name of the storm where no people died.
How about the number of deaths for the rest of the storms?
List their names and dates active as well.
SQL query sequence:
SELECT name FROM storm WHERE number_deaths  =  0;
SELECT number_deaths FROM storm WHERE number_deaths  >  0;
SELECT name ,  dates_active ,  number_deaths FROM storm WHERE number_deaths  >=  1;
Final question: List name, dates active, and number of deaths for all storms with at least 1 death.
Final SQL: SELECT name ,  dates_active ,  number_deaths FROM storm WHERE number_deaths  >=  1;
Database: storm_record
Question sequence:
Show me in the maximum damage for storms with max speed no more than 1000.
How about those with max speed higher than 1000?
Show the average and maximum damage for all storms with max speed higher than 1000.
SQL query sequence:
SELECT max(damage_millions_USD) FROM storm WHERE max_speed  <=  1000;
SELECT max(damage_millions_USD) FROM storm WHERE max_speed  >  1000;
SELECT avg(damage_millions_USD) ,  max(damage_millions_USD) FROM storm WHERE max_speed  >  1000;
Final question: Show the average and maximum damage for all storms with max speed higher than 1000.
Final SQL: SELECT avg(damage_millions_USD) ,  max(damage_millions_USD) FROM storm WHERE max_speed  >  1000;
Database: storm_record
Question sequence:
What's the average max speed for all storms?
What are the number of deaths and damage for all storms with a max speed greater than the average?
How about the total death and total damage?
SQL query sequence:
SELECT avg(max_speed) FROM storm;
SELECT number_deaths ,  damage_millions_USD FROM storm WHERE max_speed  >  (SELECT avg(max_speed) FROM storm);
SELECT sum(number_deaths) ,  sum(damage_millions_USD) FROM storm WHERE max_speed  >  (SELECT avg(max_speed) FROM storm);
Final question: What is the total number of deaths and damage for all storms with a max speed greater than the average?
Final SQL: SELECT sum(number_deaths) ,  sum(damage_millions_USD) FROM storm WHERE max_speed  >  (SELECT avg(max_speed) FROM storm);
Database: storm_record
Question sequence:
What's the date active for all storms?
How about the name and damage of all storms?
Order the result by a descending order of max speed.
SQL query sequence:
SELECT dates_active FROM storm;
SELECT name ,  damage_millions_USD FROM storm;
SELECT name ,  damage_millions_USD FROM storm ORDER BY max_speed DESC;
Final question: List name and damage for all storms in a descending order of max speed.
Final SQL: SELECT name ,  damage_millions_USD FROM storm ORDER BY max_speed DESC;
Database: storm_record
Question sequence:
What are the names of the affected regions?
Show the distinct region names.
How many distinct affected regions are there?
SQL query sequence:
SELECT region.region_name FROM region JOIN affected_region ON affected_region.region_id = region.region_id;
SELECT DISTINCT region.region_name FROM region JOIN affected_region ON affected_region.region_id = region.region_id;
SELECT count(DISTINCT region_id) FROM affected_region
Final question: How many regions are affected?
Final SQL: SELECT count(DISTINCT region_id) FROM affected_region
Database: storm_record
Question sequence:
What are the names of the regions affected?
How many are there?
How about the names of regions not affected?
SQL query sequence:
SELECT region_name FROM region WHERE region_id IN (SELECT region_id FROM affected_region);
SELECT count(region_name) FROM region WHERE region_id IN (SELECT region_id FROM affected_region);
SELECT region_name FROM region WHERE region_id NOT IN (SELECT region_id FROM affected_region);
Final question: Show the name for regions not affected.
Final SQL: SELECT region_name FROM region WHERE region_id NOT IN (SELECT region_id FROM affected_region);
Database: storm_record
Question sequence:
Show me the storm ids for each region.
What's the maximum number of storms of one region?
Show the region names and the number of storms for each region.
SQL query sequence:
SELECT T2.storm_id FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id = T2.region_id GROUP BY T1.region_id;
SELECT count(T2.storm_id) FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id = T2.region_id GROUP BY T1.region_id ORDER BY count(storm_id) DESC LIMIT 1;
SELECT T1.region_name ,  count(*) FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id = T2.region_id GROUP BY T1.region_id;
Final question: Show the name for regions and the number of storms for each region.
Final SQL: SELECT T1.region_name ,  count(*) FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id = T2.region_id GROUP BY T1.region_id;
Database: storm_record
Question sequence:
Show me the names of all storms that affect more than 1 regions?
List the name for storms and the number of affected regions for each storm.
SQL query sequence:
SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id  =  T2.storm_id GROUP BY T1.storm_id HAVING count(*) > 1;
SELECT T1.name ,  count(*) FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id  =  T2.storm_id GROUP BY T1.storm_id;
Final question: List the name for storms and the number of affected regions for each storm.
Final SQL: SELECT T1.name ,  count(*) FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id  =  T2.storm_id GROUP BY T1.storm_id;
Database: storm_record
Question sequence:
What is the name for storms and the number of affected regions for each storm.
Which storm affected the greatest number of regions?
Show its max speed in addition to its name.
SQL query sequence:
SELECT T1.name ,  count(*) FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id  =  T2.storm_id GROUP BY T1.storm_id;
SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id  =  T2.storm_id GROUP BY T1.storm_id ORDER BY count(*) DESC LIMIT 1;
SELECT T1.name ,  T1.max_speed FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id  =  T2.storm_id GROUP BY T1.storm_id ORDER BY count(*) DESC LIMIT 1;
Final question: What is the storm name and max speed which affected the greatest number of regions?
Final SQL: SELECT T1.name ,  T1.max_speed FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id  =  T2.storm_id GROUP BY T1.storm_id ORDER BY count(*) DESC LIMIT 1;
Database: storm_record
Question sequence:
What are the names of the storms that have affected regions in record?
How many such storms are there in the result?
How about the names of storms which don't have affected region in record.
SQL query sequence:
SELECT name FROM storm WHERE storm_id IN (SELECT storm_id FROM affected_region);
SELECT count(name) FROM storm WHERE storm_id IN (SELECT storm_id FROM affected_region);
SELECT name FROM storm WHERE storm_id NOT IN (SELECT storm_id FROM affected_region);
Final question: Show the name of storms which don't have affected region in record.
Final SQL: SELECT name FROM storm WHERE storm_id NOT IN (SELECT storm_id FROM affected_region);
Database: storm_record
Question sequence:
What is the name of the storm affected the most number of cities?
How about of the storms that affected at least two regions?
Among the result, which one affected at least 10 cities?
SQL query sequence:
SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id  =  T2.storm_id GROUP BY T1.storm_id ORDER BY sum(T2.number_city_affected)  DESC LIMIT 1;
SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id  =  T2.storm_id GROUP BY T1.storm_id HAVING count(*)  >=  2;
SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id  =  T2.storm_id GROUP BY T1.storm_id HAVING count(*)  >=  2 INTERSECT SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id  =  T2.storm_id GROUP BY T1.storm_id HAVING sum(T2.number_city_affected)  >=  10;
Final question: Show storm name with at least two regions and 10 cities affected.
Final SQL: SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id  =  T2.storm_id GROUP BY T1.storm_id HAVING count(*)  >=  2 INTERSECT SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id  =  T2.storm_id GROUP BY T1.storm_id HAVING sum(T2.number_city_affected)  >=  10;
Database: storm_record
Question sequence:
Show me all the storms by name.
List only ones with at least 2 affected regions.
Show all names of the storms except for these.
SQL query sequence:
SELECT name FROM storm;
SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id  =  T2.storm_id GROUP BY T1.storm_id HAVING count(*)  =  2;
SELECT name FROM storm EXCEPT SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id  =  T2.storm_id GROUP BY T1.storm_id HAVING count(*)  >=  2;
Final question: Show all storm names except for those with at least two affected regions.
Final SQL: SELECT name FROM storm EXCEPT SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id  =  T2.storm_id GROUP BY T1.storm_id HAVING count(*)  >=  2;
Database: storm_record
Question sequence:
Show me the regions affected by a storm with a damage of more than 10 million dollars?
How about those with affected by storms with no more than 10 deaths?
List the region names affected by the storm with a number of deaths of least 10.
SQL query sequence:
SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id  =  T2.region_id JOIN storm AS T3 ON T1.storm_id  =  T3.storm_id WHERE T3.damage_millions_USD  >  10;
SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id  =  T2.region_id JOIN storm AS T3 ON T1.storm_id  =  T3.storm_id WHERE T3.number_deaths  <=  10;
SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id  =  T2.region_id JOIN storm AS T3 ON T1.storm_id  =  T3.storm_id WHERE T3.number_deaths  >=  10;
Final question: What are the region names affected by the storm with a number of deaths of least 10?
Final SQL: SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id  =  T2.region_id JOIN storm AS T3 ON T1.storm_id  =  T3.storm_id WHERE T3.number_deaths  >=  10;
Database: storm_record
Question sequence:
Show me all the affected regions.
Which storm affected region Cyprus?
How about Denmark?
SQL query sequence:
SELECT region.region_name FROM region JOIN affected_region ON affected_region.region_id = region.region_id;
SELECT T3.name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id  =  T2.region_id JOIN storm AS T3 ON T1.storm_id  =  T3.storm_id WHERE T2.region_name  =  'Cyprus';
SELECT T3.name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id  =  T2.region_id JOIN storm AS T3 ON T1.storm_id  =  T3.storm_id WHERE T2.region_name  =  'Denmark';
Final question: Show all storm names affecting region "Denmark".
Final SQL: SELECT T3.name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id  =  T2.region_id JOIN storm AS T3 ON T1.storm_id  =  T3.storm_id WHERE T2.region_name  =  'Denmark';
Database: storm_record
Question sequence:
Show me the number of regions affected for each storm.
How about the number of storms for each region?
Show the region name with at least two storms.
SQL query sequence:
SELECT T1.name ,  count(*) FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id  =  T2.storm_id GROUP BY T1.storm_id;
SELECT T1.region_name ,  count(*) FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id = T2.region_id GROUP BY T1.region_id;
SELECT T1.region_name FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id = T2.region_id GROUP BY T1.region_id HAVING count(*)  >=  2;
Final question: Show the region name with at least two storms.
Final SQL: SELECT T1.region_name FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id = T2.region_id GROUP BY T1.region_id HAVING count(*)  >=  2;
Database: storm_record
Question sequence:
Show me the number of people killed for each storm.
What's the name of the one that killed the most people?
What's the names of the regions affected by this storm?
SQL query sequence:
SELECT Number_Deaths FROM storm;
SELECT name FROM storm ORDER BY Number_Deaths DESC LIMIT 1;
SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id  =  T2.region_id JOIN storm AS T3 ON T1.storm_id  =  T3.storm_id ORDER BY T3.Number_Deaths DESC LIMIT 1
Final question: Find the names of the regions which were affected by the storm that killed the greatest number of people.
Final SQL: SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id  =  T2.region_id JOIN storm AS T3 ON T1.storm_id  =  T3.storm_id ORDER BY T3.Number_Deaths DESC LIMIT 1
Database: gas_company
Question sequence:
Show company information.
How many are there?
SQL query sequence:
SELECT * FROM company
SELECT count(*) FROM company
Final question: How many gas companies are there?
Final SQL: SELECT count(*) FROM company
Database: gas_company
Question sequence:
Show the company names.
Also show the rank for each.
Show the results in decreasing order of their sales.
SQL query sequence:
SELECT company FROM company
SELECT company ,  rank FROM company
SELECT company ,  rank FROM company ORDER BY Sales_billion DESC
Final question: List the company name and rank for all companies in the decreasing order of their sales.
Final SQL: SELECT company ,  rank FROM company ORDER BY Sales_billion DESC
Database: gas_company
Question sequence:
Show the company name and the main industry for all companies.
Show the results only for those whose headquarters are not from USA.
SQL query sequence:
SELECT company ,  main_industry FROM company
SELECT company ,  main_industry FROM company WHERE headquarters != 'USA'
Final question: Show the company name and the main industry for all companies whose headquarters are not from USA.
Final SQL: SELECT company ,  main_industry FROM company WHERE headquarters != 'USA'
Database: gas_company
Question sequence:
Show all company names and headquarters.
Show them in the descending order of market value.
SQL query sequence:
SELECT company ,  headquarters FROM company
SELECT company ,  headquarters FROM company ORDER BY market_value DESC
Final question: Show all company names and headquarters in the descending order of market value.
Final SQL: SELECT company ,  headquarters FROM company ORDER BY market_value DESC
Database: gas_company
Question sequence:
Show the market value for all companies.
What are the minimum, maximum, and average of them?
SQL query sequence:
SELECT market_value FROM company
SELECT min(market_value) ,  max(market_value) ,  avg(market_value) FROM company
Final question: Show minimum, maximum, and average market value for all companies.
Final SQL: SELECT min(market_value) ,  max(market_value) ,  avg(market_value) FROM company
Database: gas_company
Question sequence:
Show the company info.
Show the main industry for them.
Remove duplicates.
SQL query sequence:
select * from company
SELECT main_industry FROM company
SELECT DISTINCT main_industry FROM company
Final question: Show all main industry for all companies.
Final SQL: SELECT DISTINCT main_industry FROM company
Database: gas_company
Question sequence:
Show all headquarters for companies.
For each of them, show the number of companies.
SQL query sequence:
SELECT headquarters FROM company
SELECT headquarters ,  count(*) FROM company GROUP BY headquarters
Final question: List all headquarters and the number of companies in each headquarter.
Final SQL: SELECT headquarters ,  count(*) FROM company GROUP BY headquarters
Database: gas_company
Question sequence:
Show all main industries for companies.
For each of them, also show the total market value.
SQL query sequence:
SELECT main_industry FROM company
SELECT main_industry ,  sum(market_value) FROM company GROUP BY main_industry
Final question: Show all main industry and total market value in each industry.
Final SQL: SELECT main_industry ,  sum(market_value) FROM company GROUP BY main_industry
Database: gas_company
Question sequence:
Show all the main industries for companies.
Order them in descending order by total market value.
What one has the highest?
Also show its number of companies.
SQL query sequence:
SELECT main_industry FROM company
SELECT main_industry FROM company GROUP BY main_industry ORDER BY sum(market_value) DESC
SELECT main_industry FROM company GROUP BY main_industry ORDER BY sum(market_value) DESC LIMIT 1
SELECT main_industry ,  count(*) FROM company GROUP BY main_industry ORDER BY sum(market_value) DESC LIMIT 1
Final question: List the main industry with highest total market value and its number of companies.
Final SQL: SELECT main_industry ,  count(*) FROM company GROUP BY main_industry ORDER BY sum(market_value) DESC LIMIT 1
Database: gas_company
Question sequence:
Show all headquarters.
For each of them, also show the number of companies in the banking industry.
Which have at least two?
SQL query sequence:
SELECT headquarters FROM company
SELECT headquarters, count(*) FROM company WHERE main_industry  =  'Banking' GROUP BY headquarters
SELECT headquarters FROM company WHERE main_industry  =  'Banking' GROUP BY headquarters HAVING count(*)  >=  2
Final question: Show headquarters with at least two companies in the banking industry.
Final SQL: SELECT headquarters FROM company WHERE main_industry  =  'Banking' GROUP BY headquarters HAVING count(*)  >=  2
Database: gas_company
Question sequence:
Show the station id for all stations.
Also show the location and the manager name for each of them.
Order the results by their opening year.
SQL query sequence:
SELECT station_id FROM gas_station
SELECT station_id ,  LOCATION ,  manager_name FROM gas_station
SELECT station_id ,  LOCATION ,  manager_name FROM gas_station ORDER BY open_year
Final question: Show gas station id, location, and manager_name for all gas stations ordered by open year.
Final SQL: SELECT station_id ,  LOCATION ,  manager_name FROM gas_station ORDER BY open_year
Database: gas_company
Question sequence:
Show the information for all gas stations.
How about those that opened between 2000 and 2005?
Show the count.
SQL query sequence:
SELECT * FROM gas_station
SELECT * FROM gas_station WHERE open_year BETWEEN 2000 AND 2005
SELECT count(*) FROM gas_station WHERE open_year BETWEEN 2000 AND 2005
Final question: How many gas station are opened between 2000 and 2005?
Final SQL: SELECT count(*) FROM gas_station WHERE open_year BETWEEN 2000 AND 2005
Database: gas_company
Question sequence:
Show locations for all gas stations.
For each of them, show the number of gas stations.
Order the results by the count.
SQL query sequence:
SELECT LOCATION FROM gas_station
SELECT LOCATION ,  count(*) FROM gas_station GROUP BY LOCATION
SELECT LOCATION ,  count(*) FROM gas_station GROUP BY LOCATION ORDER BY count(*)
Final question: Show all locations and the number of gas stations in each location ordered by the count.
Final SQL: SELECT LOCATION ,  count(*) FROM gas_station GROUP BY LOCATION ORDER BY count(*)