aherntech/sparc huggingface dataset:
Database: protein_institute
Question sequence:
Which institutions were founded after 1880?
Give the building ids of these buildings.
Only show the building ids that appear twice or more on that list.
Give the names and heights of those buildings.
SQL query sequence:
SELECT institution from institution WHERE founded > 1880
SELECT building_id, institution from institution WHERE founded > 1880
SELECT building_id from institution WHERE founded > 1880 GROUP BY building_id HAVING count(*) >= 2
SELECT T1.name ,  T1.height_feet FROM building AS T1 JOIN institution AS T2 ON T1.building_id  =  T2.building_id WHERE T2.founded  >  1880 GROUP BY T1.building_id HAVING count(*)  >=  2
Final question: Show the names and heights of buildings with at least two institutions founded after 1880.
Final SQL: SELECT T1.name ,  T1.height_feet FROM building AS T1 JOIN institution AS T2 ON T1.building_id  =  T2.building_id WHERE T2.founded  >  1880 GROUP BY T1.building_id HAVING count(*)  >=  2
Database: protein_institute
Question sequence:
Show the institution names joined with the protein names.
Aggregate, count, over the institution names.
SQL query sequence:
SELECT T1.institution ,  T2.protein_name FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id  =  T2.institution_id
SELECT T1.institution ,  count(*) FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id  =  T2.institution_id GROUP BY T1.institution_id
Final question: Show institution names along with the number of proteins for each institution.
Final SQL: SELECT T1.institution ,  count(*) FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id  =  T2.institution_id GROUP BY T1.institution_id
Database: protein_institute
Question sequence:
Which proteins are associated with institutions founded after 1880?
And which are associated with an institution with type "Private"?
Union those.
Count the union.
SQL query sequence:
SELECT T2.protein_name FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id  =  T2.institution_id WHERE T1.founded  >  1880
SELECT T2.protein_name FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id  =  T2.institution_id WHERE T1.type = 'Private'
SELECT T2.protein_name FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id  =  T2.institution_id WHERE T1.founded  >  1880 OR T1.type  =  'Private'
SELECT count(*) FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id  =  T2.institution_id WHERE T1.founded  >  1880 OR T1.type  =  'Private'
Final question: How many proteins are associated with an institution founded after 1880 or an institution with type "Private"?
Final SQL: SELECT count(*) FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id  =  T2.institution_id WHERE T1.founded  >  1880 OR T1.type  =  'Private'
Database: protein_institute
Question sequence:
Which protein names are associated with an institution in a building with at least 20 floors?
Which of those have common name equal to 'Tropical Clawed Frog'?
Give a count of the proteins in the first query.
SQL query sequence:
SELECT T2.protein_name FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id  =  T2.institution_id JOIN building AS T3 ON T3.building_id  =  T1.building_id WHERE T3.floors  >=  20
SELECT T2.protein_name FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id  =  T2.institution_id JOIN building AS T3 ON T3.building_id  =  T1.building_id WHERE T3.floors  >=  20 and T2.common_name = 'Tropical Clawed Frog'
SELECT count(*) FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id  =  T2.institution_id JOIN building AS T3 ON T3.building_id  =  T1.building_id WHERE T3.floors  >=  20
Final question: How many proteins are associated with an institution in a building with at least 20 floors?
Final SQL: SELECT count(*) FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id  =  T2.institution_id JOIN building AS T3 ON T3.building_id  =  T1.building_id WHERE T3.floors  >=  20
Database: coffee_shop
Question sequence:
show all the different member addresses.
who is living in Harford?
also include the members living in Waterbury.
SQL query sequence:
SELECT distinct address FROM member
SELECT name FROM member WHERE address  =  'Harford'
SELECT name FROM member WHERE address  =  'Harford' OR address  =  'Waterbury'
Final question: Give me the names of members whose address is in Harford or Waterbury.
Final SQL: SELECT name FROM member WHERE address  =  'Harford' OR address  =  'Waterbury'
Database: coffee_shop
Question sequence:
how many members are under age 30?
how about the number of members with a black membership card?
what is the total number between these two groups of members?
what are their ids and names?
SQL query sequence:
SELECT count(*) FROM member WHERE age  <  30
SELECT count(*) FROM member WHERE Membership_card  =  'Black'
SELECT count(*) FROM member WHERE Membership_card  =  'Black' OR age  <  30
SELECT name ,  member_id FROM member WHERE Membership_card  =  'Black' OR age  <  30
Final question: Find the ids and names of members who are under age 30 or with black membership card.
Final SQL: SELECT name ,  member_id FROM member WHERE Membership_card  =  'Black' OR age  <  30
Database: coffee_shop
Question sequence:
what are all the different membership cards?
how many members does each of them have?
which ones have more than 3 members?
how about 5?
SQL query sequence:
SELECT distinct Membership_card FROM member
SELECT count(*), Membership_card FROM member GROUP BY Membership_card
SELECT Membership_card FROM member GROUP BY Membership_card HAVING count(*)  >  3
SELECT Membership_card FROM member GROUP BY Membership_card HAVING count(*)  >  5
Final question: Which membership card has more than 5 members?
Final SQL: SELECT Membership_card FROM member GROUP BY Membership_card HAVING count(*)  >  5
Database: coffee_shop
Question sequence:
show all info about members.
which of them are older than 40?
for those who are younger than 30?
Which addresses have members in both groups?
SQL query sequence:
SELECT * FROM member
SELECT * FROM member WHERE age  >  40
SELECT * FROM member WHERE age  <  30
SELECT address FROM member WHERE age  <  30 INTERSECT SELECT address FROM member WHERE age  >  40
Final question: Which address has both members younger than 30 and members older than 40?
Final SQL: SELECT address FROM member WHERE age  <  30 INTERSECT SELECT address FROM member WHERE age  >  40
Database: coffee_shop
Question sequence:
show the names of members living in Hartford.
also those living in Waterbury.
which membership cards are held by members living in these two places?
SQL query sequence:
SELECT name FROM member WHERE address  =  'Hartford'
SELECT name FROM member WHERE address  =  'Waterbury'
SELECT membership_card FROM member WHERE address  =  'Hartford' INTERSECT SELECT membership_card FROM member WHERE address  =  'Waterbury'
Final question: What is the membership card held by both members living in Hartford and ones living in Waterbury address?
Final SQL: SELECT membership_card FROM member WHERE address  =  'Hartford' INTERSECT SELECT membership_card FROM member WHERE address  =  'Waterbury'
Database: coffee_shop
Question sequence:
what are different membership cards?
how many black ones are there?
show addresses for those who have one.
how about those who do not have one?
SQL query sequence:
SELECT distinct Membership_card FROM member
SELECT count(*) FROM member WHERE Membership_card  =  'Black'
SELECT address FROM member WHERE Membership_card  =  'Black'
SELECT address FROM member EXCEPT SELECT address FROM member WHERE Membership_card  =  'Black'
Final question: Which address do not have any member with the black membership card?
Final SQL: SELECT address FROM member EXCEPT SELECT address FROM member WHERE Membership_card  =  'Black'
Database: coffee_shop
Question sequence:
show the scores and staff numbers for all shops.
what are the averages for these two columns?
SQL query sequence:
SELECT num_of_staff, score FROM shop
SELECT avg(num_of_staff) ,  avg(score) FROM shop
Final question: What are the average score and average staff number of all shops?
Final SQL: SELECT avg(num_of_staff) ,  avg(score) FROM shop
Database: coffee_shop
Question sequence:
what is the highest score for all shops?
how about the average?
what are the id and addresses of the shops whose scores are below this?
SQL query sequence:
SELECT max(score) FROM shop
SELECT avg(score) FROM shop
SELECT shop_id,  address FROM shop WHERE score  <  (SELECT avg(score) FROM shop)
Final question: Find the id and address of the shops whose score is below the average score.
Final SQL: SELECT shop_id ,  address FROM shop WHERE score  <  (SELECT avg(score) FROM shop)
Database: coffee_shop
Question sequence:
Find the addresses of the shops where they have happy hour.
also return the staff numbers.
how about those where there is no happy hour?
SQL query sequence:
SELECT t1.address FROM shop AS t1 JOIN happy_hour AS t2 ON t1.shop_id  =  t2.shop_id
SELECT t1.address, t1.num_of_staff FROM shop AS t1 JOIN happy_hour AS t2 ON t1.shop_id  =  t2.shop_id
SELECT address ,  num_of_staff FROM shop WHERE shop_id NOT IN (SELECT shop_id FROM happy_hour)
Final question: Find the address and staff number of the shops that do not have any happy hour.
Final SQL: SELECT address ,  num_of_staff FROM shop WHERE shop_id NOT IN (SELECT shop_id FROM happy_hour)
Database: coffee_shop
Question sequence:
show the id of the shops that have a happy hour.
just show those that have happy hours in May.
return their addresses too.
SQL query sequence:
SELECT shop_id FROM happy_hour
SELECT shop_id FROM happy_hour WHERE MONTH  =  'May'
SELECT t1.address,  t1.shop_id FROM shop AS t1 JOIN happy_hour AS t2 ON t1.shop_id  =  t2.shop_id WHERE MONTH  =  'May'
Final question: What are the id and address of the shops which have a happy hour in May?
Final SQL: SELECT t1.address ,  t1.shop_id FROM shop AS t1 JOIN happy_hour AS t2 ON t1.shop_id  =  t2.shop_id WHERE MONTH  =  'May'
Database: coffee_shop
Question sequence:
find the number of happy hours in each shop. Also show shop id.
which of them has happy hour most often?
SQL query sequence:
SELECT shop_id,  count(*) FROM happy_hour GROUP BY shop_id
SELECT shop_id FROM happy_hour GROUP BY shop_id ORDER BY count(*) DESC LIMIT 1
Final question: which shop has happy hour most frequently? List its id and number of happy hours.
Final SQL: SELECT shop_id ,  count(*) FROM happy_hour GROUP BY shop_id ORDER BY count(*) DESC LIMIT 1
Database: coffee_shop
Question sequence:
how many happy hour shops are there?
for each month?
Which month has the most?
SQL query sequence:
SELECT count(*) FROM happy_hour
SELECT count(*) FROM happy_hour GROUP BY MONTH
SELECT MONTH FROM happy_hour GROUP BY MONTH ORDER BY count(*) DESC LIMIT 1
Final question: Which month has the most happy hours?
Final SQL: SELECT MONTH FROM happy_hour GROUP BY MONTH ORDER BY count(*) DESC LIMIT 1
Database: customers_campaigns_ecommerce
Question sequence:
Show information for all premises.
How many of them are there?
SQL query sequence:
SELECT * FROM premises
SELECT count(*) FROM premises
Final question: How many premises are there?
Final SQL: SELECT count(*) FROM premises
Database: customers_campaigns_ecommerce
Question sequence:
Show information for premises.
Only show the premise type for all of them.
What are the distinct types among them?
SQL query sequence:
select * FROM premises
SELECT premises_type FROM premises
SELECT DISTINCT premises_type FROM premises
Final question: What are all the distinct premise types?
Final SQL: SELECT DISTINCT premises_type FROM premises
Database: customers_campaigns_ecommerce
Question sequence:
Show the type for all premises.
Also add their details.
Order them by the premise type.
SQL query sequence:
SELECT premises_type FROM premises
SELECT premises_type ,  premise_details FROM premises
SELECT premises_type ,  premise_details FROM premises ORDER BY premises_type
Final question: Find the types and details for all premises and order by the premise type.
Final SQL: SELECT premises_type ,  premise_details FROM premises ORDER BY premises_type
Database: customers_campaigns_ecommerce
Question sequence:
Show all premise types.
Show the number of premises in each type.
SQL query sequence:
SELECT premises_type FROM premises
SELECT premises_type ,  count(*) FROM premises GROUP BY premises_type
Final question: Show each premise type and the number of premises in that type.
Final SQL: SELECT premises_type ,  count(*) FROM premises GROUP BY premises_type
Database: customers_campaigns_ecommerce
Question sequence:
Show the number of mailshot campaigns.
Breakdown the number by product category.
SQL query sequence:
SELECT count(*) FROM mailshot_campaigns
SELECT product_category ,  count(*) FROM mailshot_campaigns GROUP BY product_category
Final question: Show all distinct product categories along with the number of mailshots in each category.
Final SQL: SELECT product_category ,  count(*) FROM mailshot_campaigns GROUP BY product_category
Database: customers_campaigns_ecommerce
Question sequence:
Show all customers id with a mailshot.
How about customer ids without any?
Display the name and phone number for those customers.
SQL query sequence:
SELECT customer_id FROM mailshot_customers
SELECT customer_id FROM customers WHERE customer_id NOT IN (SELECT customer_id FROM mailshot_customers)
SELECT customer_name ,  customer_phone FROM customers WHERE customer_id NOT IN (SELECT customer_id FROM mailshot_customers)
Final question: Show the name and phone of the customer without any mailshot.
Final SQL: SELECT customer_name ,  customer_phone FROM customers WHERE customer_id NOT IN (SELECT customer_id FROM mailshot_customers)
Database: customers_campaigns_ecommerce
Question sequence:
Show the name and phone for all customers.
Only show the results for those customers with a mailshot.
Among those, how about the results for customers also with the outcome code 'No Response'.
SQL query sequence:
SELECT customer_name ,  customer_phone FROM customers
SELECT T1.customer_name ,  T1.customer_phone FROM customers AS T1 JOIN mailshot_customers AS T2 ON T1.customer_id  =  T2.customer_id
SELECT T1.customer_name ,  T1.customer_phone FROM customers AS T1 JOIN mailshot_customers AS T2 ON T1.customer_id  =  T2.customer_id WHERE T2.outcome_code  =  'No Response'
Final question: Show the name and phone for customers with a mailshot with outcome code 'No Response'.
Final SQL: SELECT T1.customer_name ,  T1.customer_phone FROM customers AS T1 JOIN mailshot_customers AS T2 ON T1.customer_id  =  T2.customer_id WHERE T2.outcome_code  =  'No Response'
Database: customers_campaigns_ecommerce
Question sequence:
Show the outcome code for all mailshot customers.
Show the count of the number of mailshots in each of those codes.
SQL query sequence:
SELECT outcome_code FROM mailshot_customers
SELECT outcome_code ,  count(*) FROM mailshot_customers GROUP BY outcome_code
Final question: Show the outcome code of mailshots along with the number of mailshots in each outcome code.
Final SQL: SELECT outcome_code ,  count(*) FROM mailshot_customers GROUP BY outcome_code
Database: customers_campaigns_ecommerce
Question sequence:
Show the names of customers.
How about the names for those who have an outcome code 'Order' of mailshots.
Only show the names of those who have at least two such codes.
SQL query sequence:
SELECT customer_name FROM customers
SELECT T2.customer_name FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id  =  T2.customer_id WHERE outcome_code  =  'Order'
SELECT T2.customer_name FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id  =  T2.customer_id WHERE outcome_code  =  'Order' GROUP BY T1.customer_id HAVING count(*)  >=  2
Final question: Show the names of customers who have at least 2 mailshots with outcome code 'Order'.
Final SQL: SELECT T2.customer_name FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id  =  T2.customer_id WHERE outcome_code  =  'Order' GROUP BY T1.customer_id HAVING count(*)  >=  2
Database: customers_campaigns_ecommerce
Question sequence:
Show the name of customers with a mailshot.
Order them by the number of mailshots in descending order.
Who has the most mailshots among them?
SQL query sequence:
SELECT T2.customer_name FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id  =  T2.customer_id
SELECT T2.customer_name FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id  =  T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC
SELECT T2.customer_name FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id  =  T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1
Final question: Show the names of customers who have the most mailshots.
Final SQL: SELECT T2.customer_name FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id  =  T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1
Database: customers_campaigns_ecommerce
Question sequence:
Show the name for customers.
Also show their payment methods.
How about the results for those haing mailshots in 'Order' outcome
What about those also having mailshots in 'No Response' outcome?
SQL query sequence:
SELECT customer_name from customers
SELECT customer_name ,  payment_method from customers
SELECT T2.customer_name ,  T2.payment_method FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id  =  T2.customer_id WHERE T1.outcome_code  =  'Order'
SELECT T2.customer_name ,  T2.payment_method FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id  =  T2.customer_id WHERE T1.outcome_code  =  'Order' INTERSECT SELECT T2.customer_name ,  T2.payment_method FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id  =  T2.customer_id WHERE T1.outcome_code  =  'No Response'
Final question: What are the name and payment method of customers who have both mailshots in 'Order' outcome and mailshots in 'No Response' outcome.
Final SQL: SELECT T2.customer_name ,  T2.payment_method FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id  =  T2.customer_id WHERE T1.outcome_code  =  'Order' INTERSECT SELECT T2.customer_name ,  T2.payment_method FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id  =  T2.customer_id WHERE T1.outcome_code  =  'No Response'
Database: customers_campaigns_ecommerce
Question sequence:
Show the address type code for all customer addresses.
For each of them, also show the premise type.
SQL query sequence:
SELECT address_type_code FROM customer_addresses
SELECT T2.premises_type ,  T1.address_type_code FROM customer_addresses AS T1 JOIN premises AS T2 ON T1.premise_id  =  T2.premise_id
Final question: Show the premise type and address type code for all customer addresses.
Final SQL: SELECT T2.premises_type ,  T1.address_type_code FROM customer_addresses AS T1 JOIN premises AS T2 ON T1.premise_id  =  T2.premise_id
Database: customers_campaigns_ecommerce
Question sequence:
Show information for all customer addresses.
Show the address type code for all customer addresses.
Filter for distinctness.
SQL query sequence:
SELECT * FROM customer_addresses
SELECT address_type_code FROM customer_addresses
SELECT DISTINCT address_type_code FROM customer_addresses
Final question: What are the distinct address type codes for all customer addresses?
Final SQL: SELECT DISTINCT address_type_code FROM customer_addresses
Database: customers_campaigns_ecommerce
Question sequence:
List the shipping charge and customer id for all customer orders.
How about the results with order status 'Cancelled'?
How about the results with order status 'Paid'.
Show the results of both.
SQL query sequence:
SELECT order_shipping_charges ,  customer_id FROM customer_orders
SELECT order_shipping_charges ,  customer_id FROM customer_orders WHERE order_status_code  =  'Cancelled'
SELECT order_shipping_charges ,  customer_id FROM customer_orders WHERE order_status_code  =  'Paid'
SELECT order_shipping_charges ,  customer_id FROM customer_orders WHERE order_status_code  =  'Cancelled' OR order_status_code  =  'Paid'
Final question: Show the shipping charge and customer id for customer orders with order status Cancelled or Paid.
Final SQL: SELECT order_shipping_charges ,  customer_id FROM customer_orders WHERE order_status_code  =  'Cancelled' OR order_status_code  =  'Paid'
Database: local_govt_mdm
Question sequence:
What are all the cross reference codes?
Show me the cross references with code as Tax.
What are the details of the cmi masters of them?
SQL query sequence:
SELECT source_system_code FROM CMI_Cross_References GROUP BY source_system_code
SELECT * FROM CMI_Cross_References WHERE source_system_code = 'Tax'
SELECT T1.cmi_details FROM Customer_Master_Index AS T1 JOIN CMI_Cross_References AS T2 ON T1.master_customer_id  =  T2.master_customer_id WHERE T2.source_system_code  =  'Tax'
Final question: what are the details of the cmi masters that have the cross reference code 'Tax'?
Final SQL: SELECT T1.cmi_details FROM Customer_Master_Index AS T1 JOIN CMI_Cross_References AS T2 ON T1.master_customer_id  =  T2.master_customer_id WHERE T2.source_system_code  =  'Tax'
Database: local_govt_mdm
Question sequence:
Show me all the council tax entries.
Show me distinct cmi cross reference ids in those.
What about their corresponding source system code?
SQL query sequence:
SELECT * FROM Council_Tax
SELECT cmi_cross_ref_id FROM Council_Tax GROUP By cmi_cross_ref_id
SELECT T1.cmi_cross_ref_id ,  T1.source_system_code FROM CMI_Cross_References AS T1 JOIN Council_Tax AS T2 ON T1.cmi_cross_ref_id  =  T2.cmi_cross_ref_id GROUP BY T1.cmi_cross_ref_id HAVING count(*)  >=  1
Final question: What is the cmi cross reference id that is related to at least one council tax entry? List the cross reference id and source system code.
Final SQL: SELECT T1.cmi_cross_ref_id ,  T1.source_system_code FROM CMI_Cross_References AS T1 JOIN Council_Tax AS T2 ON T1.cmi_cross_ref_id  =  T2.cmi_cross_ref_id GROUP BY T1.cmi_cross_ref_id HAVING count(*)  >=  1
Database: local_govt_mdm
Question sequence:
How many business rates are there?
What are the distinct cmi cross reference ids in those business rates?
Show me the number of business rates related to each of them.
Include the master customer id too.
SQL query sequence:
SELECT count(*) FROM Business_Rates
SELECT cmi_cross_ref_id FROM Business_Rates GROUP BY cmi_cross_ref_id
SELECT cmi_cross_ref_id,count(*) FROM Business_Rates GROUP BY cmi_cross_ref_id
SELECT T2.cmi_cross_ref_id ,  T2.master_customer_id ,  count(*) FROM Business_Rates AS T1 JOIN CMI_Cross_References AS T2 ON T1.cmi_cross_ref_id  =  T2.cmi_cross_ref_id GROUP BY T2.cmi_cross_ref_id
Final question: How many business rates are related to each cmi cross reference? List cross reference id, master customer id and the number of business rates.
Final SQL: SELECT T2.cmi_cross_ref_id ,  T2.master_customer_id ,  count(*) FROM Business_Rates AS T1 JOIN CMI_Cross_References AS T2 ON T1.cmi_cross_ref_id  =  T2.cmi_cross_ref_id GROUP BY T2.cmi_cross_ref_id
Database: local_govt_mdm
Question sequence:
What are the cmi cross reference ids that are related to the benefits and overpayments.
Show me their source system codes along with the benefit id.
Order them by the benefit id.
SQL query sequence:
SELECT cmi_cross_ref_id FROM Benefits_Overpayments
SELECT T1.source_system_code ,  T2.council_tax_id FROM CMI_Cross_References AS T1 JOIN Benefits_Overpayments AS T2 ON T1.cmi_cross_ref_id  =  T2.cmi_cross_ref_id
SELECT T1.source_system_code ,  T2.council_tax_id FROM CMI_Cross_References AS T1 JOIN Benefits_Overpayments AS T2 ON T1.cmi_cross_ref_id  =  T2.cmi_cross_ref_id ORDER BY T2.council_tax_id
Final question: What is the tax source system code related to the benefits and overpayments? List the code and the benefit id, order by benefit id.
Final SQL: SELECT T1.source_system_code ,  T2.council_tax_id FROM CMI_Cross_References AS T1 JOIN Benefits_Overpayments AS T2 ON T1.cmi_cross_ref_id  =  T2.cmi_cross_ref_id ORDER BY T2.council_tax_id