aherntech/sparc huggingface dataset:
Database: journal_committee
Question sequence:
Tell me Marek Siudym's age.
Show me his journals.
Okay, now I want to know the id, name of each editor and the number of journal committees they are on.
SQL query sequence:
SELECT Age FROM editor WHERE Name = "Marek Siudym"
SELECT T3.Theme FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID  =  T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID  =  T3.Journal_ID WHERE T2.Name = "Marek Siudym"
SELECT T1.editor_id ,  T1.Name ,  COUNT(*) FROM editor AS T1 JOIN journal_committee AS T2 ON T1.Editor_ID  =  T2.Editor_ID GROUP BY T1.editor_id
Final question: Show the id, name of each editor and the number of journal committees they are on.
Final SQL: SELECT T1.editor_id ,  T1.Name ,  COUNT(*) FROM editor AS T1 JOIN journal_committee AS T2 ON T1.Editor_ID  =  T2.Editor_ID GROUP BY T1.editor_id
Database: journal_committee
Question sequence:
Tell me the sales of the journal with theme Jacksonville Jaguars.
Who is its editor?
tell me the names of editors that are on at least two journal committees.
SQL query sequence:
SELECT Sales FROM journal WHERE Theme = "Jacksonville Jaguars"
SELECT T2.Name FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID  =  T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID  =  T3.Journal_ID WHERE T3.Theme = "Jacksonville Jaguars"
SELECT T1.Name FROM editor AS T1 JOIN journal_committee AS T2 ON T1.Editor_ID  =  T2.Editor_ID GROUP BY T1.Name HAVING COUNT(*)  >=  2
Final question: Show the names of editors that are on at least two journal committees.
Final SQL: SELECT T1.Name FROM editor AS T1 JOIN journal_committee AS T2 ON T1.Editor_ID  =  T2.Editor_ID GROUP BY T1.Name HAVING COUNT(*)  >=  2
Database: journal_committee
Question sequence:
tell me the number of journal committees of editor Kamila Porczyk.
Okay, I want to know the themes of his journals.
Tell me the names of editors that are not on any journal committee.
SQL query sequence:
SELECT COUNT(*) FROM editor AS T1 JOIN journal_committee AS T2 ON T1.Editor_ID  =  T2.Editor_ID WHERE T1.Name = "Kamila Porczyk"
SELECT T3.Theme FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID  =  T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID  =  T3.Journal_ID WHERE T2.Name = "Szymon Wydra"
SELECT Name FROM editor WHERE editor_id NOT IN (SELECT editor_id FROM journal_committee)
Final question: List the names of editors that are not on any journal committee.
Final SQL: SELECT Name FROM editor WHERE editor_id NOT IN (SELECT editor_id FROM journal_committee)
Database: journal_committee
Question sequence:
Tell me the themes of Marek Siudym's journals.
Okay, tell me the date of the journal with theme "at Jacksonville Jaguars".
list the date, theme and sales of the journal which did not have any of the listed editors serving on committee.
SQL query sequence:
SELECT T3.Theme FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID  =  T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID  =  T3.Journal_ID WHERE T2.Name = "Marek Siudym"
SELECT Date FROM journal WHERE Theme = "at Jacksonville Jaguars"
SELECT date ,  theme ,  sales FROM journal EXCEPT SELECT T1.date ,  T1.theme ,  T1.sales FROM journal AS T1 JOIN journal_committee AS T2 ON T1.journal_ID  =  T2.journal_ID
Final question: List the date, theme and sales of the journal which did not have any of the listed editors serving on committee.
Final SQL: SELECT date ,  theme ,  sales FROM journal EXCEPT SELECT T1.date ,  T1.theme ,  T1.sales FROM journal AS T1 JOIN journal_committee AS T2 ON T1.journal_ID  =  T2.journal_ID
Database: department_store
Question sequence:
What is the total amount purchased for each product?
List the ids of products in decreasing order of their total amount purchased.
Just give me the top three.
SQL query sequence:
SELECT product_id, total_amount_purchased FROM product_suppliers
SELECT product_id FROM product_suppliers ORDER BY total_amount_purchased DESC
SELECT product_id FROM product_suppliers ORDER BY total_amount_purchased DESC LIMIT 3
Final question: What are the ids of the top three products that were purchased in the largest amount?
Final SQL: SELECT product_id FROM product_suppliers ORDER BY total_amount_purchased DESC LIMIT 3
Database: department_store
Question sequence:
List all the product ids.
Order them by the product price.
Show the product id and product type of the cheapest product.
SQL query sequence:
SELECT product_id FROM products
SELECT product_id FROM products ORDER BY product_price
SELECT product_id ,  product_type_code FROM products ORDER BY product_price LIMIT 1
Final question: What are the product id and product type of the cheapest product?
Final SQL: SELECT product_id ,  product_type_code FROM products ORDER BY product_price LIMIT 1
Database: department_store
Question sequence:
What are all the product types?
Show me all the distinct product types.
How many are there?
SQL query sequence:
SELECT product_type_code FROM products
SELECT DISTINCT product_type_code FROM products
SELECT count(DISTINCT product_type_code) FROM products
Final question: Find the number of different product types.
Final SQL: SELECT count(DISTINCT product_type_code) FROM products
Database: department_store
Question sequence:
Show all the information about customer addresses.
What is the address id of customer 10?
What are address details of customer 10?
SQL query sequence:
Select * from customer_addresses
Select address_id from customer_addresses where customer_id  =  10
SELECT T1.address_details FROM addresses AS T1 JOIN customer_addresses AS T2 ON T1.address_id  =  T2.address_id WHERE T2.customer_id  =  10
Final question: Return the address of customer 10.
Final SQL: SELECT T1.address_details FROM addresses AS T1 JOIN customer_addresses AS T2 ON T1.address_id  =  T2.address_id WHERE T2.customer_id  =  10
Database: department_store
Question sequence:
Show all staff information.
What are the staff ids and genders of all staffs?
What are the staff ids and genders of all staffs whose job title is Department Manager?
SQL query sequence:
SELECT * FROM staff
SELECT staff_id ,  staff_gender FROM staff
SELECT T1.staff_id ,  T1.staff_gender FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id  =  T2.staff_id WHERE T2.job_title_code  =  "Department Manager"
Final question: What are the staff ids and genders of all staffs whose job title is Department Manager?
Final SQL: SELECT T1.staff_id ,  T1.staff_gender FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id  =  T2.staff_id WHERE T2.job_title_code  =  "Department Manager"
Database: department_store
Question sequence:
Show all the customers.
How many customers are there?
For each payment method, find how many customers use it.
SQL query sequence:
SELECT * FROM customers
SELECT count(*) FROM customers
SELECT payment_method_code ,  count(*) FROM customers GROUP BY payment_method_code
Final question: For each payment method, return how many customers use it.
Final SQL: SELECT payment_method_code ,  count(*) FROM customers GROUP BY payment_method_code
Database: department_store
Question sequence:
Show all the order items.
Show the number of times each product was ordered.
What is the id of the product that was ordered the most often?
SQL query sequence:
SELECT * FROM order_items
SELECT count(*) FROM order_items GROUP BY product_id
SELECT product_id FROM order_items GROUP BY product_id ORDER BY count(*) DESC LIMIT 1
Final question: What is the id of the product that was ordered the most often?
Final SQL: SELECT product_id FROM order_items GROUP BY product_id ORDER BY count(*) DESC LIMIT 1
Database: department_store
Question sequence:
Show all the customer information.
How many orders did each customer make?
Which customer made the largest number of orders?
What are the name, phone number and email address of this customer?
SQL query sequence:
SELECT * FROM customers
SELECT count(*) FROM customer_orders GROUP BY customer_id
SELECT * FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id GROUP BY T2.customer_id ORDER BY count(*) DESC LIMIT 1
SELECT T1.customer_name ,  T1.customer_phone ,  T1.customer_email FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id GROUP BY T2.customer_id ORDER BY count(*) DESC LIMIT 1
Final question: What are the name, phone number and email address of the customer who made the largest number of orders?
Final SQL: SELECT T1.customer_name ,  T1.customer_phone ,  T1.customer_email FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id GROUP BY T2.customer_id ORDER BY count(*) DESC LIMIT 1
Database: department_store
Question sequence:
Show all the products.
Group all the products by product type.
What is the average price for each type of product?
SQL query sequence:
SELECT * FROM products
SELECT * FROM products GROUP BY product_type_code
SELECT product_type_code ,  avg(product_price) FROM products GROUP BY product_type_code
Final question: What is the average price for each type of product?
Final SQL: SELECT product_type_code ,  avg(product_price) FROM products GROUP BY product_type_code
Database: department_store
Question sequence:
What are all the department stores?
What are all the department stores that the store chain South has?
How many are there?
SQL query sequence:
SELECT * FROM department_stores
SELECT * FROM department_stores AS T1 JOIN department_store_chain AS T2 ON T1.dept_store_chain_id  =  T2.dept_store_chain_id WHERE T2.dept_store_chain_name  =  "South"
SELECT count(*) FROM department_stores AS T1 JOIN department_store_chain AS T2 ON T1.dept_store_chain_id  =  T2.dept_store_chain_id WHERE T2.dept_store_chain_name  =  "South"
Final question: How many department stores does the store chain South have?
Final SQL: SELECT count(*) FROM department_stores AS T1 JOIN department_store_chain AS T2 ON T1.dept_store_chain_id  =  T2.dept_store_chain_id WHERE T2.dept_store_chain_name  =  "South"
Database: department_store
Question sequence:
Show all the staff.
Sort all the staff by their assigned date in a descending manner.
What is the name and job title of the staff who was assigned the latest?
SQL query sequence:
SELECT * FROM staff
SELECT * FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id  =  T2.staff_id ORDER BY T2.date_assigned_to DESC LIMIT 1
SELECT T1.staff_name ,  T2.job_title_code FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id  =  T2.staff_id ORDER BY T2.date_assigned_to DESC LIMIT 1
Final question: What is the name and job title of the staff who was assigned the latest?
Final SQL: SELECT T1.staff_name ,  T2.job_title_code FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id  =  T2.staff_id ORDER BY T2.date_assigned_to DESC LIMIT 1
Database: department_store
Question sequence:
What are all the products?
Which products are supplied by supplier id 3?
Give me the product type, name and price for these products.
SQL query sequence:
SELECT * FROM products
SELECT * FROM product_suppliers AS T1 JOIN products AS T2 ON T1.product_id  =  T2.product_id WHERE T1.supplier_id  =  3
SELECT T2.product_type_code ,  T2.product_name ,  T2.product_price FROM product_suppliers AS T1 JOIN products AS T2 ON T1.product_id  =  T2.product_id WHERE T1.supplier_id  =  3
Final question: Give me the product type, name and price for all the products supplied by supplier id 3.
Final SQL: SELECT T2.product_type_code ,  T2.product_name ,  T2.product_price FROM product_suppliers AS T1 JOIN products AS T2 ON T1.product_id  =  T2.product_id WHERE T1.supplier_id  =  3
Database: department_store
Question sequence:
Find all the customers.
Which customers have order status Pending? Show their names.
Sort them in the order of customer id.
SQL query sequence:
SELECT * FROM customers
SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id WHERE T2.order_status_code  =  "Pending"
SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id WHERE T2.order_status_code  =  "Pending" ORDER BY T2.customer_id
Final question: Return the distinct name of customers whose order status is Pending, in the order of customer id.
Final SQL: SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id WHERE T2.order_status_code  =  "Pending" ORDER BY T2.customer_id
Database: department_store
Question sequence:
Show all the customers.
Which customers have both New and Pending orders?
Show these customers' names and addresses.
SQL query sequence:
SELECT * FROM customers
SELECT * FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id WHERE T2.order_status_code  =  "New" INTERSECT SELECT * FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id WHERE T2.order_status_code  =  "Pending"
SELECT T1.customer_name ,  T1.customer_address FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id WHERE T2.order_status_code  =  "New" INTERSECT SELECT T1.customer_name ,  T1.customer_address FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id WHERE T2.order_status_code  =  "Pending"
Final question: Find the name and address of the customers who have both New and Pending orders.
Final SQL: SELECT T1.customer_name ,  T1.customer_address FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id WHERE T2.order_status_code  =  "New" INTERSECT SELECT T1.customer_name ,  T1.customer_address FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id WHERE T2.order_status_code  =  "Pending"
Database: department_store
Question sequence:
Show me all the products.
Which products are supplied by supplier id 2?
Which products are more expensive than the average price of all products?
Return ids of all the products that are supplied by supplier id 2 and are more expensive than the average price of all products.
SQL query sequence:
SELECT * FROM products
SELECT T1.product_id FROM product_suppliers AS T1 JOIN products AS T2 ON T1.product_id  =  T2.product_id WHERE T1.supplier_id  =  2
SELECT product_id FROM products WHERE product_price  >  (SELECT avg(product_price) FROM products)
SELECT T1.product_id FROM product_suppliers AS T1 JOIN products AS T2 ON T1.product_id  =  T2.product_id WHERE T1.supplier_id  =  2 AND T2.product_price  >  (SELECT avg(product_price) FROM products)
Final question: Return ids of all the products that are supplied by supplier id 2 and are more expensive than the average price of all products.
Final SQL: SELECT T1.product_id FROM product_suppliers AS T1 JOIN products AS T2 ON T1.product_id  =  T2.product_id WHERE T1.supplier_id  =  2 AND T2.product_price  >  (SELECT avg(product_price) FROM products)
Database: department_store
Question sequence:
Which department store has a marketing department?
Which department store has both a marketing and a managing department?
Give me their id and name.
SQL query sequence:
SELECT * FROM departments AS T1 JOIN department_stores AS T2 ON T1.dept_store_id  =  T2.dept_store_id WHERE T1.department_name  =  "marketing"
SELECT * FROM departments AS T1 JOIN department_stores AS T2 ON T1.dept_store_id  =  T2.dept_store_id WHERE T1.department_name  =  "marketing" INTERSECT SELECT * FROM departments AS T1 JOIN department_stores AS T2 ON T1.dept_store_id  =  T2.dept_store_id WHERE T1.department_name  =  "managing"
SELECT T2.dept_store_id ,  T2.store_name FROM departments AS T1 JOIN department_stores AS T2 ON T1.dept_store_id  =  T2.dept_store_id WHERE T1.department_name  =  "marketing" INTERSECT SELECT T2.dept_store_id ,  T2.store_name FROM departments AS T1 JOIN department_stores AS T2 ON T1.dept_store_id  =  T2.dept_store_id WHERE T1.department_name  =  "managing"
Final question: What is the id and name of the department store that has both marketing and managing department?
Final SQL: SELECT T2.dept_store_id ,  T2.store_name FROM departments AS T1 JOIN department_stores AS T2 ON T1.dept_store_id  =  T2.dept_store_id WHERE T1.department_name  =  "marketing" INTERSECT SELECT T2.dept_store_id ,  T2.store_name FROM departments AS T1 JOIN department_stores AS T2 ON T1.dept_store_id  =  T2.dept_store_id WHERE T1.department_name  =  "managing"
Database: department_store
Question sequence:
Count the number of department stores each department store chain has.
Which department store chain has the largest number of department stores?
What are the ids of the top two department store chains by number of department stores?
SQL query sequence:
SELECT count(*) FROM department_stores GROUP BY dept_store_chain_id
SELECT * FROM department_stores GROUP BY dept_store_chain_id ORDER BY count(*) DESC LIMIT 1
SELECT dept_store_chain_id FROM department_stores GROUP BY dept_store_chain_id ORDER BY count(*) DESC LIMIT 2
Final question: What are the ids of the two department store chains with the largest number of department stores?
Final SQL: SELECT dept_store_chain_id FROM department_stores GROUP BY dept_store_chain_id ORDER BY count(*) DESC LIMIT 2
Database: department_store
Question sequence:
Count the number of staff for each department.
Which department has the least number of staff?
What is the id of this department?
SQL query sequence:
SELECT count(*) FROM staff_department_assignments GROUP BY department_id
SELECT * FROM staff_department_assignments GROUP BY department_id ORDER BY count(*) LIMIT 1
SELECT department_id FROM staff_department_assignments GROUP BY department_id ORDER BY count(*) LIMIT 1
Final question: What is the id of the department with the least number of staff?
Final SQL: SELECT department_id FROM staff_department_assignments GROUP BY department_id ORDER BY count(*) LIMIT 1
Database: department_store
Question sequence:
Show all the product types.
Order all the products by their types.
Give me the maximum and minimum price for each product type.
SQL query sequence:
SELECT product_type_code FROM products
SELECT * FROM products ORDER BY product_type_code
SELECT product_type_code ,  max(product_price) ,  min(product_price) FROM products GROUP BY product_type_code
Final question: For each product type, return the maximum and minimum price.
Final SQL: SELECT product_type_code ,  max(product_price) ,  min(product_price) FROM products GROUP BY product_type_code
Database: department_store
Question sequence:
What are all the product types?
What is the average price of products?
Find the product type whose average price is higher than the average price of all products.
SQL query sequence:
SELECT product_type_code FROM products
SELECT avg(product_price) FROM products
SELECT product_type_code FROM products GROUP BY product_type_code HAVING avg(product_price)  >  (SELECT avg(product_price) FROM products)
Final question: Find the product type whose average price is higher than the average price of all products.
Final SQL: SELECT product_type_code FROM products GROUP BY product_type_code HAVING avg(product_price)  >  (SELECT avg(product_price) FROM products)
Database: department_store
Question sequence:
Show all the staff.
What is the assignment period for each staff?
Find the id and name of the staff who has been assigned for the shortest period.
SQL query sequence:
SELECT * FROM staff
SELECT date_assigned_to - date_assigned_from FROM Staff_Department_Assignments
SELECT T1.staff_id ,  T1.staff_name FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id  =  T2.staff_id ORDER BY date_assigned_to - date_assigned_from LIMIT 1
Final question: Find the id and name of the staff who has been assigned for the shortest period.
Final SQL: SELECT T1.staff_id ,  T1.staff_name FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id  =  T2.staff_id ORDER BY date_assigned_to - date_assigned_from LIMIT 1
Database: department_store
Question sequence:
What is the price of each product?
Which product costs between 600 and 700?
Give me their product names and ids.
SQL query sequence:
SELECT product_price FROM products
SELECT * FROM products WHERE product_price BETWEEN 600 AND 700
SELECT product_name ,  product_id FROM products WHERE product_price BETWEEN 600 AND 700
Final question: Return the names and ids of all products whose price is between 600 and 700.
Final SQL: SELECT product_name ,  product_id FROM products WHERE product_price BETWEEN 600 AND 700
Database: department_store
Question sequence:
Show all distinct customer ids.
When was the first time some orders were cancelled?
Find the ids of all distinct customers who made orders after this date.
SQL query sequence:
SELECT DISTINCT customer_id FROM Customer_Orders
SELECT min(order_date) FROM Customer_Orders WHERE order_status_code  =  "Cancelled"
SELECT DISTINCT customer_id FROM Customer_Orders WHERE order_date  >  (SELECT min(order_date) FROM Customer_Orders WHERE order_status_code  =  "Cancelled")
Final question: Find the ids of all distinct customers who made order after some orders that were Cancelled.
Final SQL: SELECT DISTINCT customer_id FROM Customer_Orders WHERE order_date  >  (SELECT min(order_date) FROM Customer_Orders WHERE order_status_code  =  "Cancelled")
Database: department_store
Question sequence:
Show the information about all the staff department assignments.
When was the latest department assignment of Clerical Staff?
What is id of the staff who had a Staff Department Assignment earlier than this date?
SQL query sequence:
SELECT * FROM Staff_Department_Assignments
SELECT max(date_assigned_to) FROM Staff_Department_Assignments WHERE job_title_code  =  'Clerical Staff'
SELECT staff_id FROM Staff_Department_Assignments WHERE date_assigned_to  <  (SELECT max(date_assigned_to) FROM Staff_Department_Assignments WHERE job_title_code  =  'Clerical Staff')
Final question: What is id of the staff who had a Staff Department Assignment earlier than any Clerical Staff?
Final SQL: SELECT staff_id FROM Staff_Department_Assignments WHERE date_assigned_to  <  (SELECT max(date_assigned_to) FROM Staff_Department_Assignments WHERE job_title_code  =  'Clerical Staff')
Database: department_store
Question sequence:
Give me the information about all the customers.
Which customers have an address that contains TN?
What are their names and ids?
SQL query sequence:
SELECT * FROM customers
SELECT * FROM customers WHERE customer_address LIKE "%TN%"
SELECT customer_name ,  customer_id FROM customers WHERE customer_address LIKE "%TN%"
Final question: What are the names and ids of customers whose address contains TN?
Final SQL: SELECT customer_name ,  customer_id FROM customers WHERE customer_address LIKE "%TN%"
Database: department_store
Question sequence:
Show all the staff department assignments.
Which staff was assigned in 2016?
What are their names and genders?
SQL query sequence:
SELECT * FROM staff_department_assignments
SELECT * FROM staff_department_assignments WHERE date_assigned_from LIKE "2016%"
SELECT T1.staff_name ,  T1.staff_gender FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id  =  T2.staff_id WHERE T2.date_assigned_from LIKE "2016%"
Final question: Return the name and gender of the staff who was assigned in 2016.
Final SQL: SELECT T1.staff_name ,  T1.staff_gender FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id  =  T2.staff_id WHERE T2.date_assigned_from LIKE "2016%"
Database: department_store
Question sequence:
Return all the staff department assignments.
Count the number of assignments for each staff.
List the names of staff who have been assigned multiple jobs.
SQL query sequence:
SELECT * FROM staff_department_assignments
SELECT COUNT (*) FROM staff_department_assignments GROUP BY staff_id
SELECT T1.staff_name FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id  =  T2.staff_id GROUP BY T2.staff_id HAVING COUNT (*)  >  1
Final question: List the name of staff who has been assigned multiple jobs.
Final SQL: SELECT T1.staff_name FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id  =  T2.staff_id GROUP BY T2.staff_id HAVING COUNT (*)  >  1