aherntech/sparc huggingface dataset:
Database: assets_maintenance
Question sequence:
Show me engineers each staff has contacted. List the names of contact staff and engineers.
How many engineers did each staff contact? List the count instead of the names of engineers.
SQL query sequence:
SELECT T1.staff_name ,  T3.first_name FROM Staff AS T1 JOIN Engineer_Visits AS T2 ON T1.staff_id  =  T2.contact_staff_id JOIN Maintenance_Engineers AS T3 ON T2.engineer_id = T3.engineer_id GROUP BY T1.staff_name
SELECT T1.staff_name ,  count(*) FROM Staff AS T1 JOIN Engineer_Visits AS T2 ON T1.staff_id  =  T2.contact_staff_id GROUP BY T1.staff_name
Final question: How many engineers did each staff contact? List both the contact staff name and number of engineers contacted.
Final SQL: SELECT T1.staff_name ,  count(*) FROM Staff AS T1 JOIN Engineer_Visits AS T2 ON T1.staff_id  =  T2.contact_staff_id GROUP BY T1.staff_name
Database: station_weather
Question sequence:
Show me all about stations.
What are the network names?
How about the local authorities and services provided by all stations.
SQL query sequence:
SELECT * FROM station;
SELECT network_name FROM station;
SELECT local_authority ,  services FROM station;
Final question: list the local authorities and services provided by all stations.
Final SQL: SELECT local_authority ,  services FROM station;
Database: station_weather
Question sequence:
Show me the origin of all trains ordered by time early to late.
Now show me the train_number for all trains ordered by time early to late.
Also provide the train_name for each of the result above.
SQL query sequence:
SELECT origin FROM train ORDER BY time;
SELECT train_number FROM train ORDER BY TIME;
SELECT train_number ,  name FROM train ORDER BY TIME;
Final question: show all train numbers and names ordered by their time from early to late.
Final SQL: SELECT train_number ,  name FROM train ORDER BY TIME;
Database: station_weather
Question sequence:
What's time for trains going to Mumbai?
How about the time and train number for trains going to Chennai?
Order the result by time.
SQL query sequence:
SELECT time FROM train WHERE destination  =  'Mumbai';
SELECT TIME ,  train_number FROM train WHERE destination  =  'Chennai';
SELECT TIME ,  train_number FROM train WHERE destination  =  'Chennai' ORDER BY TIME;
Final question: Give me the times and numbers of all trains that go to Chennai, ordered by time.
Final SQL: SELECT TIME ,  train_number FROM train WHERE destination  =  'Chennai' ORDER BY TIME;
Database: station_weather
Question sequence:
Show me the train names.
How many distinct names are there?
How many trains have 'Express' in their names?
SQL query sequence:
SELECT name FROM train;
SELECT count(DISTINCT name) FROM train;
SELECT count(*) FROM train WHERE name LIKE "%Express%";
Final question: How many trains have 'Express' in their names?
Final SQL: SELECT count(*) FROM train WHERE name LIKE "%Express%";
Database: station_weather
Question sequence:
How many trains are going from Chennai to Guruvayur?
What times are they each going?
Find both train number and time.
SQL query sequence:
SELECT count(*) FROM train WHERE origin  =  'Chennai' AND destination  =  'Guruvayur';
SELECT time FROM train WHERE origin  =  'Chennai' AND destination  =  'Guruvayur';
SELECT train_number ,  time FROM train WHERE origin  =  'Chennai' AND destination  =  'Guruvayur';
Final question: Find the number and time of the train that goes from Chennai to Guruvayur.
Final SQL: SELECT train_number ,  TIME FROM train WHERE origin  =  'Chennai' AND destination  =  'Guruvayur';
Database: station_weather
Question sequence:
What are the origins of all trains?
Which origin has the most number of trains?
Find the number of trains starting from each origin.
SQL query sequence:
SELECT origin FROM train;
SELECT origin FROM train GROUP BY origin ORDER BY count(*) DESC LIMIT 1;
SELECT origin ,  count(*) FROM train GROUP BY origin;
Final question: Find the number of trains starting from each origin.
Final SQL: SELECT origin ,  count(*) FROM train GROUP BY origin;
Database: station_weather
Question sequence:
Show me the station names.
How about the name of trains and the number of stations each runs through?
Of these, return the name with the greatest number of stations.
SQL query sequence:
SELECT network_name FROM station;
SELECT t1.name, count(*) FROM train AS t1 JOIN route AS t2 ON t1.id  =  t2.train_id GROUP BY t2.train_id;
SELECT t1.name FROM train AS t1 JOIN route AS t2 ON t1.id  =  t2.train_id GROUP BY t2.train_id ORDER BY count(*) DESC LIMIT 1;
Final question: Find the name of the train whose route runs through greatest number of stations.
Final SQL: SELECT t1.name FROM train AS t1 JOIN route AS t2 ON t1.id  =  t2.train_id GROUP BY t2.train_id ORDER BY count(*) DESC LIMIT 1;
Database: station_weather
Question sequence:
Can you list the services for each station?
Can you also show the the number of trains for each station?
Also include the the station network name.
SQL query sequence:
SELECT services FROM station;
SELECT count(*) ,  t1.services FROM station AS t1 JOIN route AS t2 ON t1.id  =  t2.station_id GROUP BY t2.station_id;
SELECT count(*) ,  t1.network_name ,  t1.services FROM station AS t1 JOIN route AS t2 ON t1.id  =  t2.station_id GROUP BY t2.station_id;
Final question: Find the number of trains for each station, as well as the station network name and services.
Final SQL: SELECT count(*) ,  t1.network_name ,  t1.services FROM station AS t1 JOIN route AS t2 ON t1.id  =  t2.station_id GROUP BY t2.station_id;
Database: station_weather
Question sequence:
What's the average low temperature of Monday?
How about its average high temperature?
Show me the average high temperature for each day of week?
SQL query sequence:
SELECT avg(low_temperature) FROM weekly_weather WHERE day_of_week = "Monday";
SELECT avg(high_temperature) FROM weekly_weather WHERE day_of_week = "Monday";
SELECT avg(high_temperature) ,  day_of_week FROM weekly_weather GROUP BY day_of_week;
Final question: What is the average high temperature for each day of week?
Final SQL: SELECT avg(high_temperature) ,  day_of_week FROM weekly_weather GROUP BY day_of_week;
Database: station_weather
Question sequence:
Show me the all about weather for all stations.
What's the maximum low temperature and average precipitation for Bushey station?
How about for the Amersham station?
SQL query sequence:
SELECT * FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id  =  t2.id;
SELECT max(t1.low_temperature) ,  avg(t1.precipitation) FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id  =  t2.id WHERE t2.network_name  =  "Bushey";
SELECT max(t1.low_temperature) ,  avg(t1.precipitation) FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id  =  t2.id WHERE t2.network_name  =  "Amersham";
Final question: Give me the maximum low temperature and average precipitation at the Amersham station.
Final SQL: SELECT max(t1.low_temperature) ,  avg(t1.precipitation) FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id  =  t2.id WHERE t2.network_name  =  "Amersham";
Database: station_weather
Question sequence:
Show me the names of trains that run through a station serviced by Greater Anglia.
How about stations for local authority Chiltern?
For these, also provide the times of each train.
SQL query sequence:
SELECT t3.name FROM station AS t1 JOIN route AS t2 ON t1.id  =  t2.station_id JOIN train AS t3 ON t2.train_id  =  t3.id WHERE t1.services  =  "Greater Anglia";
SELECT t3.name FROM station AS t1 JOIN route AS t2 ON t1.id  =  t2.station_id JOIN train AS t3 ON t2.train_id  =  t3.id WHERE t1.local_authority  =  "Chiltern";
SELECT t3.name ,  t3.time FROM station AS t1 JOIN route AS t2 ON t1.id  =  t2.station_id JOIN train AS t3 ON t2.train_id  =  t3.id WHERE t1.local_authority  =  "Chiltern";
Final question: Find names and times of trains that run through stations for the local authority Chiltern.
Final SQL: SELECT t3.name ,  t3.time FROM station AS t1 JOIN route AS t2 ON t1.id  =  t2.station_id JOIN train AS t3 ON t2.train_id  =  t3.id WHERE t1.local_authority  =  "Chiltern";
Database: station_weather
Question sequence:
Show me the services provided by all stations.
How about the number of services?
How many distinct ones are there?
SQL query sequence:
SELECT services FROM station;
SELECT count(services) FROM station;
SELECT count(DISTINCT services) FROM station;
Final question: How many different services are provided by all stations?
Final SQL: SELECT count(DISTINCT services) FROM station;
Database: station_weather
Question sequence:
What's the high temperature of each station?
What's the id of the station with highest average high temperature?
Also show me the local authority of this station.
SQL query sequence:
SELECT t1.high_temperature FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id  =  t2.id;
SELECT t2.id FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id  =  t2.id GROUP BY t1.station_id ORDER BY avg(high_temperature) DESC LIMIT 1
SELECT t2.id ,  t2.local_authority FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id  =  t2.id GROUP BY t1.station_id ORDER BY avg(high_temperature) DESC LIMIT 1
Final question: Find the id and local authority of the station with has the highest average high temperature.
Final SQL: SELECT t2.id ,  t2.local_authority FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id  =  t2.id GROUP BY t1.station_id ORDER BY avg(high_temperature) DESC LIMIT 1
Database: station_weather
Question sequence:
List the minimum precipitation of each station.
How about the max precipitation? Show station id as well.
Find the id and local authority of the station whose maximum precipitation is higher than 50.
SQL query sequence:
SELECT min(t1.precipitation) FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id  =  t2.id GROUP BY t1.station_id;
SELECT t2.id, max(t1.precipitation) FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id  =  t2.id GROUP BY t1.station_id;
SELECT t2.id ,  t2.local_authority FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id  =  t2.id GROUP BY t1.station_id HAVING max(t1.precipitation)  >  50;
Final question: Find the id and local authority of the station whose maximum precipitation is higher than 50.
Final SQL: SELECT t2.id ,  t2.local_authority FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id  =  t2.id GROUP BY t1.station_id HAVING max(t1.precipitation)  >  50;
Database: station_weather
Question sequence:
What's average low_temperature per week?
How about the average wind speed per week in miles per hour?
Show the weekly lowest low temperature and weekly highest wind speed in miles per hour.
SQL query sequence:
SELECT avg(low_temperature) FROM weekly_weather;
SELECT avg(wind_speed_mph) FROM weekly_weather;
SELECT min(low_temperature) ,  max(wind_speed_mph) FROM weekly_weather;
Final question: show the lowest low temperature and highest wind speed in miles per hour.
Final SQL: SELECT min(low_temperature) ,  max(wind_speed_mph) FROM weekly_weather;
Database: culture_company
Question sequence:
Show information for all book clubs.
How many of them?
SQL query sequence:
SELECT * FROM book_club
SELECT count(*) FROM book_club
Final question: How many book clubs are there?
Final SQL: SELECT count(*) FROM book_club
Database: culture_company
Question sequence:
Show the title for all books.
Also show the authors or editors for each of them.
How about the results for those published after the year 1989?
SQL query sequence:
SELECT book_title FROM book_club
SELECT book_title ,  author_or_editor FROM book_club
SELECT book_title ,  author_or_editor FROM book_club WHERE YEAR  >  1989
Final question: show the titles, and authors or editors for all books made after the year 1989.
Final SQL: SELECT book_title ,  author_or_editor FROM book_club WHERE YEAR  >  1989
Database: culture_company
Question sequence:
Show information for all books.
What are the distinct publishers for them?
SQL query sequence:
SELECT * FROM book_club
SELECT DISTINCT publisher FROM book_club
Final question: Show all distinct publishers for books.
Final SQL: SELECT DISTINCT publisher FROM book_club
Database: culture_company
Question sequence:
Show the titles of all books.
Also show the year published and the publisher.
Order the results in descending order by year.
SQL query sequence:
SELECT book_title FROM book_club
SELECT YEAR ,  book_title ,  publisher FROM book_club
SELECT YEAR ,  book_title ,  publisher FROM book_club ORDER BY YEAR DESC
Final question: Show the years, book titles, and publishers for all books, in descending order by year.
Final SQL: SELECT YEAR ,  book_title ,  publisher FROM book_club ORDER BY YEAR DESC
Database: culture_company
Question sequence:
Show the publisher for all books.
Count the number of books published by each of them.
SQL query sequence:
SELECT publisher FROM book_club
SELECT publisher ,  count(*) FROM book_club GROUP BY publisher
Final question: Show all publishers and the number of books for each publisher.
Final SQL: SELECT publisher ,  count(*) FROM book_club GROUP BY publisher
Database: culture_company
Question sequence:
Show the publisher for all books.
For each of them, how many books are published?
Can you order them by the count in descending order?
Which one has the most?
SQL query sequence:
SELECT publisher FROM book_club
SELECT publisher, count(*) FROM book_club GROUP BY publisher
SELECT publisher FROM book_club GROUP BY publisher ORDER BY count(*) DESC
SELECT publisher FROM book_club GROUP BY publisher ORDER BY count(*) DESC LIMIT 1
Final question: What is the publisher with most number of books?
Final SQL: SELECT publisher FROM book_club GROUP BY publisher ORDER BY count(*) DESC LIMIT 1
Database: culture_company
Question sequence:
How many books are there in total?
Can you break down the count by the book category?
SQL query sequence:
SELECT count(*) FROM book_club
SELECT category ,  count(*) FROM book_club GROUP BY category
Final question: Show all book categories and the number of books in each category.
Final SQL: SELECT category ,  count(*) FROM book_club GROUP BY category
Database: culture_company
Question sequence:
Show all categories for books.
For each of them, count the number of books published after 1989.
Which categories have at least two such books?
SQL query sequence:
SELECT category FROM book_club
SELECT category, count(*) FROM book_club WHERE YEAR  >  1989 GROUP BY category
SELECT category FROM book_club WHERE YEAR  >  1989 GROUP BY category HAVING count(*)  >=  2
Final question: List categories that have at least two books after year 1989.
Final SQL: SELECT category FROM book_club WHERE YEAR  >  1989 GROUP BY category HAVING count(*)  >=  2
Database: culture_company
Question sequence:
Show the publisher for all books.
Who published a book in 1989?
Among those, who also published a book in 1990?
SQL query sequence:
SELECT publisher FROM book_club
SELECT publisher FROM book_club WHERE YEAR  =  1989
SELECT publisher FROM book_club WHERE YEAR  =  1989 INTERSECT SELECT publisher FROM book_club WHERE YEAR  =  1990
Final question: Show publishers with a book published in 1989 and a book in 1990.
Final SQL: SELECT publisher FROM book_club WHERE YEAR  =  1989 INTERSECT SELECT publisher FROM book_club WHERE YEAR  =  1990
Database: culture_company
Question sequence:
Show publishers that published a book in 1989.
Show all publishers who do not have such a book.
SQL query sequence:
SELECT publisher FROM book_club WHERE YEAR  =  1989
SELECT publisher FROM book_club EXCEPT SELECT publisher FROM book_club WHERE YEAR  =  1989
Final question: Show all publishers which do not have a book in 1989.
Final SQL: SELECT publisher FROM book_club EXCEPT SELECT publisher FROM book_club WHERE YEAR  =  1989
Database: culture_company
Question sequence:
Show the title and year for all movies.
Also show the director for each of them.
Order the results by their budgets.
SQL query sequence:
SELECT title ,  YEAR  FROM movie
SELECT title ,  YEAR ,  director FROM movie
SELECT title ,  YEAR ,  director FROM movie ORDER BY budget_million
Final question: Show all movie titles, years, and directors, ordered by budget.
Final SQL: SELECT title ,  YEAR ,  director FROM movie ORDER BY budget_million
Database: culture_company
Question sequence:
Show the director for all movies.
How many are there?
SQL query sequence:
SELECT director FROM movie
SELECT COUNT (DISTINCT director) FROM movie
Final question: How many movie directors are there?
Final SQL: SELECT COUNT (DISTINCT director) FROM movie
Database: culture_company
Question sequence:
Show the title and director for all movies.
Only show the results for those in the year 2000 or before.
Order the results by the worldwide gross in descending order.
Which one has the highest?
SQL query sequence:
SELECT title ,  director FROM movie
SELECT title ,  director FROM movie WHERE YEAR  <=  2000
SELECT title ,  director FROM movie WHERE YEAR  <=  2000 ORDER BY gross_worldwide DESC
SELECT title ,  director FROM movie WHERE YEAR  <=  2000 ORDER BY gross_worldwide DESC LIMIT 1
Final question: What is the title and director for the movie with highest worldwide gross in the year 2000 or before?
Final SQL: SELECT title ,  director FROM movie WHERE YEAR  <=  2000 ORDER BY gross_worldwide DESC LIMIT 1
Database: culture_company
Question sequence:
Show all director names.
Who has a movie in 1999?
Who has a movie in 2000?
Who has movies in both years?
SQL query sequence:
SELECT director FROM movie
SELECT director FROM movie WHERE YEAR  =  1999
SELECT director FROM movie WHERE YEAR  =  2000
SELECT director FROM movie WHERE YEAR  =  2000 INTERSECT SELECT director FROM movie WHERE YEAR  =  1999
Final question: Show all director names who have a movie in both year 1999 and 2000.
Final SQL: SELECT director FROM movie WHERE YEAR  =  2000 INTERSECT SELECT director FROM movie WHERE YEAR  =  1999
Database: culture_company
Question sequence:
Show all director names.
Among them, who has a movie in 1999?
Also show those who have a movie in 2000.
SQL query sequence:
SELECT director FROM movie
SELECT director FROM movie WHERE YEAR  =  1999
SELECT director FROM movie WHERE YEAR  =  1999 OR YEAR  =  2000
Final question: Show all director names who have a movie in the year 1999 or 2000.
Final SQL: SELECT director FROM movie WHERE YEAR  =  1999 OR YEAR  =  2000
Database: culture_company
Question sequence:
Show the budget for all movies.
What about the budget for those before 2000?
Show their average, maximum, and minimum budget.
SQL query sequence:
select budget_million from movie
select budget_million from movie WHERE YEAR  <  2000
SELECT avg(budget_million) ,  max(budget_million) ,  min(budget_million) FROM movie WHERE YEAR  <  2000
Final question: What is the average, maximum, and minimum budget for all movies before 2000.
Final SQL: SELECT avg(budget_million) ,  max(budget_million) ,  min(budget_million) FROM movie WHERE YEAR  <  2000
Database: culture_company
Question sequence:
Show all company names.
Only show the companies with a book.
What about the companies with a book published by Alyson?
SQL query sequence:
SELECT company_name FROM culture_company
SELECT T1.company_name FROM culture_company AS T1 JOIN book_club AS T2 ON T1.book_club_id  =  T2.book_club_id
SELECT T1.company_name FROM culture_company AS T1 JOIN book_club AS T2 ON T1.book_club_id  =  T2.book_club_id WHERE T2.publisher  =  'Alyson'
Final question: List all company names with a book published by Alyson.
Final SQL: SELECT T1.company_name FROM culture_company AS T1 JOIN book_club AS T2 ON T1.book_club_id  =  T2.book_club_id WHERE T2.publisher  =  'Alyson'
Database: culture_company
Question sequence:
Show all movie titles.
Show all movie titles for all companies in China.
For those companies, also show all the book titles.
SQL query sequence:
SELECT title from movie
SELECT T1.title FROM movie AS T1 JOIN culture_company AS T2 ON T1.movie_id  =  T2.movie_id WHERE T2.incorporated_in  =  'China'
SELECT T1.title ,  T3.book_title FROM movie AS T1 JOIN culture_company AS T2 ON T1.movie_id  =  T2.movie_id JOIN book_club AS T3 ON T3.book_club_id  =  T2.book_club_id WHERE T2.incorporated_in  =  'China'
Final question: Show the movie titles and book titles for all companies in China.
Final SQL: SELECT T1.title ,  T3.book_title FROM movie AS T1 JOIN culture_company AS T2 ON T1.movie_id  =  T2.movie_id JOIN book_club AS T3 ON T3.book_club_id  =  T2.book_club_id WHERE T2.incorporated_in  =  'China'
Database: architecture
Question sequence:
Find all female architects.
How many are there?
SQL query sequence:
SELECT * FROM architect WHERE gender  =  'female'
SELECT count(*) FROM architect WHERE gender  =  'female'
Final question: How many architects are female?
Final SQL: SELECT count(*) FROM architect WHERE gender  =  'female'
Database: architecture
Question sequence:
Return all the male architects.
What are their names, nationalities and ids?
Sort them by name.
SQL query sequence:
SELECT * FROM architect WHERE gender  =  'male'
SELECT name ,  nationality ,  id FROM architect WHERE gender  =  'male'
SELECT name ,  nationality ,  id FROM architect WHERE gender  =  'male' ORDER BY name
Final question: List the name, nationality and id of all male architects ordered by their names lexicographically.
Final SQL: SELECT name ,  nationality ,  id FROM architect WHERE gender  =  'male' ORDER BY name
Database: architecture
Question sequence:
What is the length in meters of each bridge?
Find the maximum length.
Show the maximum length in meters of the bridges and the name of the architect that made it.
SQL query sequence:
SELECT length_meters FROM bridge
SELECT max(length_meters) FROM bridge
SELECT max(T1.length_meters) ,  T2.name FROM bridge AS T1 JOIN architect AS T2 ON T1.architect_id  =  T2.id
Final question: What is the maximum length in meters for the bridges and what are the architects' names?
Final SQL: SELECT max(T1.length_meters) ,  T2.name FROM bridge AS T1 JOIN architect AS T2 ON T1.architect_id  =  T2.id
Database: architecture
Question sequence:
What is the length in feet of each bridge?
Find the average length.
SQL query sequence:
SELECT length_feet FROM bridge
SELECT avg(length_meters) FROM bridge
Final question: What is the average length in feet of the bridges?
Final SQL: SELECT avg(length_feet) FROM bridge
Database: architecture
Question sequence:
What are the names of all the mills?
What are the names of all the mills of 'Grondzeiler' type?
Also show the years that they were built.
SQL query sequence:
SELECT name FROM mill
SELECT name FROM mill WHERE TYPE  =  'Grondzeiler'
SELECT name ,  built_year FROM mill WHERE TYPE  =  'Grondzeiler'
Final question: What are the names and year of construction for the mills of 'Grondzeiler' type?
Final SQL: SELECT name ,  built_year FROM mill WHERE TYPE  =  'Grondzeiler'
Database: architecture
Question sequence:
What are the ids of the architects who built a mill?
What are all their distinct names and nationalities?
SQL query sequence:
SELECT architect_id FROM mill
SELECT DISTINCT T1.name ,  T1.nationality FROM architect AS T1 JOIN mill AS t2 ON T1.id  =  T2.architect_id
Final question: What are the distinct names and nationalities of the architects who have ever built a mill?
Final SQL: SELECT DISTINCT T1.name ,  T1.nationality FROM architect AS T1 JOIN mill AS t2 ON T1.id  =  T2.architect_id
Database: architecture
Question sequence:
Show the information for all mills.
Which mills are not located in 'Donceel'?
What are their names?
SQL query sequence:
SELECT * FROM mill
SELECT * FROM mill WHERE LOCATION != 'Donceel'
SELECT name FROM mill WHERE LOCATION != 'Donceel'
Final question: What are the names of the mills which are not located in 'Donceel'?
Final SQL: SELECT name FROM mill WHERE LOCATION != 'Donceel'