aherntech/sparc huggingface dataset:
Database: customers_and_addresses
Question sequence:
List all the customers' payment method
Which customer does not use Cash?
What is the name of the customer?
SQL query sequence:
SELECT payment_method FROM customers
SELECT * FROM customers WHERE payment_method ! =  'Cash'
SELECT customer_name FROM customers WHERE payment_method ! =  'Cash'
Final question: What is the name of customers who do not use Cash as payment method.
Final SQL: SELECT customer_name FROM customers WHERE payment_method ! =  'Cash'
Database: customers_and_addresses
Question sequence:
Find the names of all the customers.
What are the names of customers who bought the product "Latte" before?
Which customers never bought Latte"?
SQL query sequence:
SELECT customer_name FROM customers
SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id JOIN products AS t4 ON t3.product_id  =  t4.product_id WHERE product_details  =  'Latte'
SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id JOIN products AS t4 ON t3.product_id  =  t4.product_id WHERE product_details  =  'Latte'
Final question: What are names of customers who never ordered product Latte.
Final SQL: SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id JOIN products AS t4 ON t3.product_id  =  t4.product_id WHERE product_details  =  'Latte'
Database: customers_and_addresses
Question sequence:
List the names of all the customers.
What are the names of customers who have made some orders before?
Which customers never made an order?
SQL query sequence:
SELECT customer_name FROM customers
SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id
SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id
Final question: What are the names of customers who never made an order.
Final SQL: SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id
Database: customers_and_addresses
Question sequence:
List the names of customers who have purchased Latte.
Give me the names of customers who have purchased Americano.
Which customers have ordered both?
SQL query sequence:
SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id JOIN products AS t4 ON t3.product_id  =  t4.product_id WHERE product_details  =  'Latte'
SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id JOIN products AS t4 ON t3.product_id  =  t4.product_id WHERE product_details  =  'Americano'
SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id JOIN products AS t4 ON t3.product_id  =  t4.product_id WHERE product_details  =  'Latte' INTERSECT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id JOIN products AS t4 ON t3.product_id  =  t4.product_id WHERE product_details  =  'Americano'
Final question: What are the names of customers who have purchased both products Latte and Americano?
Final SQL: SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id JOIN products AS t4 ON t3.product_id  =  t4.product_id WHERE product_details  =  'Latte' INTERSECT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id JOIN products AS t4 ON t3.product_id  =  t4.product_id WHERE product_details  =  'Americano'
Database: hr_1
Question sequence:
What are the first names of all employees?
Also, what are their department names?
SQL query sequence:
SELECT first_name FROM employees
SELECT T1.first_name ,  T2.department_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id
Final question: What are the first name and department name of all employees?
Final SQL: SELECT T1.first_name ,  T2.department_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id
Database: hr_1
Question sequence:
Which employees earn less than 6000?
What are their full names and salaries?
SQL query sequence:
SELECT * FROM employees WHERE salary  <  6000
SELECT first_name ,  last_name ,  salary FROM employees WHERE salary  <  6000
Final question: What are the full names and salaries for any employees earning less than 6000?
Final SQL: SELECT first_name ,  last_name ,  salary FROM employees WHERE salary  <  6000
Database: hr_1
Question sequence:
List the first name and department id for all employees?
Of these, include the ones for employees with last name McEwen.
SQL query sequence:
SELECT first_name ,  department_id FROM employees
SELECT first_name ,  department_id FROM employees WHERE last_name  =  'McEwen'
Final question: What are the first names and department numbers for employees with last name McEwen?
Final SQL: SELECT first_name ,  department_id FROM employees WHERE last_name  =  'McEwen'
Database: hr_1
Question sequence:
What is all the information about all the departments?
Of those, what is the information about the Marketing department?
SQL query sequence:
SELECT * FROM  departments
SELECT * FROM  departments WHERE department_name  =  'Marketing'
Final question: What is all the information about the Marketing department?
Final SQL: SELECT * FROM  departments WHERE department_name  =  'Marketing'
Database: hr_1
Question sequence:
What is all the information on employees?
Of those, which do not have the letter M in their first names?
What were their hire dates?
SQL query sequence:
SELECT * FROM employees
SELECT * FROM employees WHERE first_name NOT LIKE '%M%'
SELECT hire_date FROM employees WHERE first_name NOT LIKE '%M%'
Final question: On what dates were employees without the letter M in their first names hired?
Final SQL: SELECT hire_date FROM employees WHERE first_name NOT LIKE '%M%'
Database: hr_1
Question sequence:
What is all the information on employees?
Of those, which do not have the letter M in their first names?
What were their full names, hire dates, salaries, and department numbers?
SQL query sequence:
SELECT * FROM employees
SELECT * FROM employees WHERE first_name NOT LIKE '%M%'
SELECT first_name ,  last_name ,  hire_date ,  salary ,  department_id FROM employees WHERE first_name NOT LIKE '%M%'
Final question: What are the full name, hire date, salary, and department id for employees without the letter M in their first name?
Final SQL: SELECT first_name ,  last_name ,  hire_date ,  salary ,  department_id FROM employees WHERE first_name NOT LIKE '%M%'
Database: hr_1
Question sequence:
Which employees do not have the letter M in their first names?
What were their full names, hire dates, salaries, and department numbers?
Order these by ascending department number.
SQL query sequence:
SELECT * FROM employees WHERE first_name NOT LIKE '%M%'
SELECT first_name ,  last_name ,  hire_date ,  salary ,  department_id FROM employees WHERE first_name NOT LIKE '%M%'
SELECT first_name ,  last_name ,  hire_date ,  salary ,  department_id FROM employees WHERE first_name NOT LIKE '%M%' ORDER BY department_id
Final question: What are the full name, hire data, salary and department id for employees without the letter M in their first name, ordered by ascending department id?
Final SQL: SELECT first_name ,  last_name ,  hire_date ,  salary ,  department_id FROM employees WHERE first_name NOT LIKE '%M%' ORDER BY department_id
Database: hr_1
Question sequence:
What are all the employees' phone numbers?
Return only those for employees with salaries between 8000 and 12000.
SQL query sequence:
SELECT phone_number FROM employees
SELECT phone_number FROM employees WHERE salary BETWEEN 8000 AND 12000
Final question: Return the phone numbers of employees with salaries between 8000 and 12000.
Final SQL: SELECT phone_number FROM employees WHERE salary BETWEEN 8000 AND 12000
Database: hr_1
Question sequence:
What are all the employees with first names that end with m?
What are their full names and salaries?
SQL query sequence:
SELECT * FROM employees WHERE first_name LIKE '%m'
SELECT first_name ,  last_name ,  salary FROM employees WHERE first_name LIKE '%m'
Final question: Return the full names and salaries for employees with first names that end with the letter m.
Final SQL: SELECT first_name ,  last_name ,  salary FROM employees WHERE first_name LIKE '%m'
Database: hr_1
Question sequence:
Which employees were hired between November 5th, 2007 and July 5th, 2009?
What are their job ids and hire dates?
SQL query sequence:
SELECT * FROM employees WHERE hire_date BETWEEN '2007-11-05' AND '2009-07-05'
SELECT job_id ,  hire_date FROM employees WHERE hire_date BETWEEN '2007-11-05' AND '2009-07-05'
Final question: What are the job ids and dates of hire for employees hired after November 5th, 2007 and before July 5th, 2009?
Final SQL: SELECT job_id ,  hire_date FROM employees WHERE hire_date BETWEEN '2007-11-05' AND '2009-07-05'
Database: hr_1
Question sequence:
What are the names of all employees?
Of those, who are in department 70 or 90?
SQL query sequence:
SELECT first_name ,  last_name FROM employees
SELECT first_name ,  last_name FROM employees WHERE department_id  =  70 OR department_id  =  90
Final question: What are the full names of employees who with in department 70 or 90?
Final SQL: SELECT first_name ,  last_name FROM employees WHERE department_id  =  70 OR department_id  =  90
Database: hr_1
Question sequence:
What is all the information about employees?
Of those, which were hired before 2002-06-21?
SQL query sequence:
SELECT * FROM employees
SELECT * FROM employees WHERE hire_date  <  '2002-06-21'
Final question: What is all the information about employees hired before June 21, 2002?
Final SQL: SELECT * FROM employees WHERE hire_date  <  '2002-06-21'
Database: hr_1
Question sequence:
What is all the information about employees with a D, S or N in their first name?
Order those by decreasing salary.
SQL query sequence:
SELECT * FROM employees WHERE first_name LIKE '%D%' OR first_name LIKE '%S%' OR first_name LIKE '%N%'
SELECT * FROM employees WHERE first_name LIKE '%D%' OR first_name LIKE '%S%' OR first_name LIKE '%N%' ORDER BY salary DESC
Final question: What is all the information about employees with D, S, or N in their first name, ordered by salary descending?
Final SQL: SELECT * FROM employees WHERE first_name LIKE '%D%' OR first_name LIKE '%S%' OR first_name LIKE '%N%' ORDER BY salary DESC
Database: hr_1
Question sequence:
What is all the information about the employees?
Of those, who was hired after September 7th, 1987?
SQL query sequence:
SELECT * FROM employees
SELECT * FROM employees WHERE hire_date  >  '1987-09-07'
Final question: Which employees were hired after September 7th, 1987?
Final SQL: SELECT * FROM employees WHERE hire_date  >  '1987-09-07'
Database: hr_1
Question sequence:
What are all the job titles?
Of those, which correspond to jobs with salaries over 9000?
SQL query sequence:
SELECT job_title FROM jobs
SELECT job_title FROM jobs WHERE min_salary  >  9000
Final question: Which job titles correspond to jobs with salaries over 9000?
Final SQL: SELECT job_title FROM jobs WHERE min_salary  >  9000
Database: hr_1
Question sequence:
What is all the information about jobs with max salary between 12000 and 18000?
What are the job titles and differences between max and min salaries for those jobs?
SQL query sequence:
SELECT * FROM jobs WHERE max_salary BETWEEN 12000 AND 18000
SELECT job_title ,  max_salary - min_salary FROM jobs WHERE max_salary BETWEEN 12000 AND 18000
Final question: What are the job titles, and range of salaries for jobs with maximum salary between 12000 and 18000?
Final SQL: SELECT job_title ,  max_salary - min_salary FROM jobs WHERE max_salary BETWEEN 12000 AND 18000
Database: hr_1
Question sequence:
What is all the job history information?
What are the unique employee ids?
What are the latest end dates corresponding to each one?
SQL query sequence:
SELECT * FROM job_history
SELECT employee_id FROM job_history GROUP BY employee_id
SELECT employee_id ,  MAX(end_date) FROM job_history GROUP BY employee_id
Final question: What are the employee ids for each employee and final dates of employment at their last job?
Final SQL: SELECT employee_id ,  MAX(end_date) FROM job_history GROUP BY employee_id
Database: hr_1
Question sequence:
What are the different department ids?
Of these, which had more than 10 employees with commissions?
SQL query sequence:
SELECT department_id FROM employees GROUP BY department_id
SELECT department_id FROM employees GROUP BY department_id HAVING COUNT(commission_pct) > 10
Final question: What are the department ids for which more than 10 employees had a commission?
Final SQL: SELECT department_id FROM employees GROUP BY department_id HAVING COUNT(commission_pct) > 10
Database: hr_1
Question sequence:
What are the manager ids of managers who manage 4 or more employees?
What are their department ids?
SQL query sequence:
SELECT manager_id FROM employees GROUP BY manager_id HAVING COUNT(employee_id)  >= 4
SELECT DISTINCT department_id FROM employees GROUP BY department_id ,  manager_id HAVING COUNT(employee_id)  >= 4
Final question: What are department ids for departments with managers managing more than 3 employees?
Final SQL: SELECT DISTINCT department_id FROM employees GROUP BY department_id ,  manager_id HAVING COUNT(employee_id)  >= 4
Database: hr_1
Question sequence:
How many cities are there?
Count the cities by their country ids.
SQL query sequence:
SELECT COUNT(*) FROM locations
SELECT country_id ,  COUNT(*) FROM locations GROUP BY country_id
Final question: Give the country id and corresponding count of cities in each country.
Final SQL: SELECT country_id ,  COUNT(*) FROM locations GROUP BY country_id
Database: hr_1
Question sequence:
What are job ids for jobs that lasted more than 300 days?
Of these, which have been done more than once?
SQL query sequence:
SELECT job_id FROM job_history WHERE end_date - start_date  > 300
SELECT job_id FROM job_history WHERE end_date - start_date  > 300 GROUP BY job_id HAVING COUNT(*) >= 2
Final question: What are the job ids for jobs done more than once for a period of more than 300 days?
Final SQL: SELECT job_id FROM job_history WHERE end_date - start_date  > 300 GROUP BY job_id HAVING COUNT(*) >= 2
Database: hr_1
Question sequence:
What are all the different employee ids in the job history table?
Of these, which have had two or more jobs?
SQL query sequence:
SELECT employee_id FROM job_history
SELECT employee_id FROM job_history GROUP BY employee_id HAVING COUNT(*)  >= 2
Final question: What are the employee ids for employees who have held two or more jobs?
Final SQL: SELECT employee_id FROM job_history GROUP BY employee_id HAVING COUNT(*)  >= 2
Database: hr_1
Question sequence:
What are all the employee ids?
Also, what are the names of the countries that they work in?
SQL query sequence:
SELECT employee_id FROM employees
SELECT employee_id ,  country_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id JOIN locations AS T3 ON T2.location_id  =  T3.location_id JOIN countries AS T4 ON T3.country_id  =  T4.country_id
Final question: What are all the employee ids and the names of the countries in which they work?
Final SQL: SELECT employee_id ,  country_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id JOIN locations AS T3 ON T2.location_id  =  T3.location_id JOIN countries AS T4 ON T3.country_id  =  T4.country_id
Database: hr_1
Question sequence:
How many employees are there?
Group these counts by department name.
SQL query sequence:
SELECT COUNT(*) FROM employees
SELECT T2.department_name ,  COUNT(*) FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id GROUP BY T2.department_name
Final question: Give the name of each department and the number of employees in each.
Final SQL: SELECT T2.department_name ,  COUNT(*) FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id GROUP BY T2.department_name
Database: hr_1
Question sequence:
What is the average salary for all employees?
What are the average salaries by job title?
SQL query sequence:
SELECT AVG(salary) FROM employees
SELECT job_title ,  AVG(salary) FROM employees AS T1 JOIN jobs AS T2 ON T1.job_id  =  T2.job_id GROUP BY T2.job_title
Final question: What is the average salary for each job title?
Final SQL: SELECT job_title ,  AVG(salary) FROM employees AS T1 JOIN jobs AS T2 ON T1.job_id  =  T2.job_id GROUP BY T2.job_title
Database: hr_1
Question sequence:
What is the salary of employee with id 163?
What is all employee information for employees making more than employee 163?
What are the full names of these employees?
SQL query sequence:
SELECT salary FROM employees WHERE employee_id = 163
SELECT * FROM employees WHERE salary  >  (SELECT salary FROM employees WHERE employee_id = 163 )
SELECT first_name ,  last_name FROM employees WHERE salary  >  (SELECT salary FROM employees WHERE employee_id = 163 )
Final question: Provide the full names of employees earning more than the employee with id 163.
Final SQL: SELECT first_name ,  last_name FROM employees WHERE salary  >  (SELECT salary FROM employees WHERE employee_id = 163 )
Database: hr_1
Question sequence:
What is the lowest salary across all employees?
What are these numbers by department id?
SQL query sequence:
SELECT MIN(salary) FROM employees
SELECT MIN(salary) ,  department_id FROM employees GROUP BY department_id
Final question: What is the minimum salary in each department?
Final SQL: SELECT MIN(salary) ,  department_id FROM employees GROUP BY department_id
Database: hr_1
Question sequence:
What is the lowest salary across all departments?
What information is available for employees who make that much?
What are their first and last names and department ids?
SQL query sequence:
SELECT MIN(salary) FROM employees GROUP BY department_id
SELECT * FROM employees WHERE salary IN (SELECT MIN(salary) FROM employees GROUP BY department_id)
SELECT first_name ,  last_name ,  department_id FROM employees WHERE salary IN (SELECT MIN(salary) FROM employees GROUP BY department_id)
Final question: What are the full names and department ids for the lowest paid employees across all departments.
Final SQL: SELECT first_name ,  last_name ,  department_id FROM employees WHERE salary IN (SELECT MIN(salary) FROM employees GROUP BY department_id)
Database: hr_1
Question sequence:
What is the average salary across all employees?
Which employees make more than that?
What are their ids?
SQL query sequence:
SELECT AVG(salary) FROM employees
SELECT * FROM employees WHERE salary  >  (SELECT AVG(salary) FROM employees)
SELECT employee_id FROM employees WHERE salary  >  (SELECT AVG(salary) FROM employees)
Final question: What are the employee ids for employees who make more than the average?
Final SQL: SELECT employee_id FROM employees WHERE salary  >  (SELECT AVG(salary) FROM employees)
Database: hr_1
Question sequence:
What are the id for the employee whose first name is Payam?
Which employees' manager is him?
What are their ids and salaries?
SQL query sequence:
SELECT employee_id FROM employees WHERE first_name  =  'Payam'
SELECT * FROM employees WHERE manager_id  =  (SELECT employee_id FROM employees WHERE first_name  =  'Payam' )
SELECT employee_id ,  salary FROM employees WHERE manager_id  =  (SELECT employee_id FROM employees WHERE first_name  =  'Payam' )
Final question: What are the employee ids of employees who report to Payam, and what are their salaries?
Final SQL: SELECT employee_id ,  salary FROM employees WHERE manager_id  =  (SELECT employee_id FROM employees WHERE first_name  =  'Payam' )
Database: hr_1
Question sequence:
Find the name of all departments.
What about those that have at least one employee.
SQL query sequence:
SELECT DISTINCT department_name FROM departments
SELECT DISTINCT department_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id
Final question: What are the names of departments that have at least one employee.
Final SQL: SELECT DISTINCT T2.department_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id
Database: hr_1
Question sequence:
What are all the manager ids of the different departments?
What is all the employee information regarding these managers?
SQL query sequence:
SELECT manager_id FROM departments
SELECT DISTINCT * FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id WHERE T1.employee_id  =  T2.manager_id
Final question: What is all the information regarding employees who are managers?
Final SQL: SELECT DISTINCT * FROM employees AS T1 JOIN departments AS T2 ON T1.department_id  =  T2.department_id WHERE T1.employee_id  =  T2.manager_id
Database: hr_1
Question sequence:
What is all the information about all the departments?
Of these, what information pertains to the Marketing department?
SQL query sequence:
SELECT * FROM  departments
SELECT * FROM  departments WHERE department_name  =  'Marketing'
Final question: What is all the information about the Marketing department?
Final SQL: SELECT * FROM  departments WHERE department_name  =  'Marketing'
Database: hr_1
Question sequence:
What are the ids of employees who have job history available?
Which of them have held two or more jobs?
SQL query sequence:
SELECT employee_id FROM job_history
SELECT employee_id FROM job_history GROUP BY employee_id HAVING COUNT(*)  >= 2
Final question: What are the employee ids for those who had two or more jobs.
Final SQL: SELECT employee_id FROM job_history GROUP BY employee_id HAVING COUNT(*)  >= 2
Database: hr_1
Question sequence:
What are the manager ids for managers who are in charge of 4 or more employees?
What are the distinct department ids for the departments they belong to?
SQL query sequence:
SELECT manager_id FROM employees GROUP BY manager_id HAVING COUNT(employee_id)  >= 4
SELECT DISTINCT department_id FROM employees GROUP BY department_id ,  manager_id HAVING COUNT(employee_id)  >= 4
Final question: Give the distinct department ids of departments in which a manager is in charge of 4 or more employees?
Final SQL: SELECT DISTINCT department_id FROM employees GROUP BY department_id ,  manager_id HAVING COUNT(employee_id)  >= 4
Database: hr_1
Question sequence:
What is the average salary for each job?
What are the job ids for jobs that average more than 8000?
SQL query sequence:
SELECT avg(salary) FROM employees GROUP BY job_id
SELECT job_id FROM employees GROUP BY job_id HAVING AVG(salary) > 8000
Final question: What are the job ids corresponding to jobs with average salary above 8000?
Final SQL: SELECT job_id FROM employees GROUP BY job_id HAVING AVG(salary) > 8000
Database: hr_1
Question sequence:
What are the employee ids for employees in department 80?
Also, what are their job titles?
SQL query sequence:
SELECT employee_id FROM employees WHERE department_id = 80
SELECT T1.employee_id ,  T2.job_title FROM employees AS T1 JOIN jobs AS T2 ON T1.job_id  =  T2.job_id WHERE T1.department_id = 80
Final question: what are the employee ids and job titles for employees in department 80?
Final SQL: SELECT T1.employee_id ,  T2.job_title FROM employees AS T1 JOIN jobs AS T2 ON T1.job_id  =  T2.job_id WHERE T1.department_id = 80