aherntech/sparc huggingface dataset:
Database: dog_kennels
Question sequence:
Show the professional first names and the corresponding treatment type codes for the treatment.
What about each professional's id, role, email and the treatment type code?
Which professional did not provide any treatment? Keep the id, role and email.
SQL query sequence:
SELECT T1.first_name, T2.treatment_type_code  FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id  =  T2.professional_id
SELECT T1.professional_id ,  T1.role_code ,  T1.email_address, T2.treatment_type_code  FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id  =  T2.professional_id
SELECT professional_id ,  role_code ,  email_address FROM Professionals EXCEPT SELECT T1.professional_id ,  T1.role_code ,  T1.email_address FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id  =  T2.professional_id
Final question: Which professional did not operate any treatment on dogs? List the professional's id, role and email.
Final SQL: SELECT professional_id ,  role_code ,  email_address FROM Professionals EXCEPT SELECT T1.professional_id ,  T1.role_code ,  T1.email_address FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id  =  T2.professional_id
Database: dog_kennels
Question sequence:
Show the number of dogs for each owner, keep the owner id.
Which one has 2 dogs?
What about the one with the most dogs?
SQL query sequence:
SELECT T1.owner_id ,count(*) FROM Dogs AS T1 JOIN Owners AS T2 ON T1.owner_id  =  T2.owner_id GROUP BY T1.owner_id
SELECT T1.owner_id ,  T2.first_name ,  T2.last_name, count(*) FROM Dogs AS T1 JOIN Owners AS T2 ON T1.owner_id  =  T2.owner_id GROUP BY T1.owner_id Having count(*) = 2
SELECT T1.owner_id ,  T2.first_name ,  T2.last_name FROM Dogs AS T1 JOIN Owners AS T2 ON T1.owner_id  =  T2.owner_id GROUP BY T1.owner_id ORDER BY count(*) DESC LIMIT 1
Final question: Which owner owns the most dogs? List the owner id, first name and last name.
Final SQL: SELECT T1.owner_id ,  T2.first_name ,  T2.last_name FROM Dogs AS T1 JOIN Owners AS T2 ON T1.owner_id  =  T2.owner_id GROUP BY T1.owner_id ORDER BY count(*) DESC LIMIT 1
Database: dog_kennels
Question sequence:
How many treatment does each professional finished?
Show the first name of the professionals who did only 1 treatment.
What about at least two treatments?
Show the id, role, and first name of each from the above.
SQL query sequence:
SELECT T1.professional_id , count(*) FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id  =  T2.professional_id GROUP BY T1.professional_id
SELECT T1.first_name FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id  =  T2.professional_id GROUP BY T1.professional_id Having count(*) = 1
SELECT T1.first_name FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id  =  T2.professional_id GROUP BY T1.professional_id Having count(*) >= 2
SELECT T1.professional_id ,  T1.role_code ,  T1.first_name FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id  =  T2.professional_id GROUP BY T1.professional_id HAVING count(*)  >=  2
Final question: Which professionals have done at least two treatments? List the professional's id, role, and first name.
Final SQL: SELECT T1.professional_id ,  T1.role_code ,  T1.first_name FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id  =  T2.professional_id GROUP BY T1.professional_id HAVING count(*)  >=  2
Database: dog_kennels
Question sequence:
How many dogs for each breed code?
Which breed codes are the most popular two?
What about the most common 1?
What name is the breed?
SQL query sequence:
SELECT breed_code, count(*) FROM Dogs GROUP BY breed_code
SELECT breed_code, count(*) FROM Dogs GROUP BY breed_code limit 2
SELECT breed_code, count(*) FROM Dogs GROUP BY breed_code limit 1
SELECT T1.breed_name FROM Breeds AS T1 JOIN Dogs AS T2 ON T1.breed_code  =  T2.breed_code GROUP BY T1.breed_name ORDER BY count(*) DESC LIMIT 1
Final question: What is the name of the breed with the most dogs?
Final SQL: SELECT T1.breed_name FROM Breeds AS T1 JOIN Dogs AS T2 ON T1.breed_code  =  T2.breed_code GROUP BY T1.breed_name ORDER BY count(*) DESC LIMIT 1
Database: dog_kennels
Question sequence:
Show the dog name and total cost of each dog.
What are the owner names and the cost from their dogs.
Who has paid for the most treatments on the dogs? Keep owner IDs and last names.
SQL query sequence:
SELECT name, sum(cost_of_treatment) FROM Treatments AS T1 JOIN dogs AS T2 ON T1.dog_id = T2.dog_id GROUP BY T1.dog_id
SELECT T1.owner_id, T3.cost_of_treatment  FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id  =  T2.owner_id JOIN Treatments AS T3 ON T2.dog_id  =  T3.dog_id GROUP BY T1.owner_id
SELECT T1.owner_id ,  T1.last_name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id  =  T2.owner_id JOIN Treatments AS T3 ON T2.dog_id  =  T3.dog_id GROUP BY T1.owner_id ORDER BY count(*) DESC LIMIT 1
Final question: Which owner has paid for the most treatments on his or her dogs? List the owner id and last name.
Final SQL: SELECT T1.owner_id ,  T1.last_name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id  =  T2.owner_id JOIN Treatments AS T3 ON T2.dog_id  =  T3.dog_id GROUP BY T1.owner_id ORDER BY count(*) DESC LIMIT 1
Database: dog_kennels
Question sequence:
List the treatment type code and the description.
For each treatment type, calculate the sum of costs, and order them in descending order.
Show the treatment type description also.
So what is the description of the treatment type that costs the least money in total?
SQL query sequence:
SELECT * FROM Treatment_Types
SELECT treatment_type_code, sum(cost_of_treatment) FROM Treatments group by treatment_type_code order by sum(cost_of_treatment) desc
SELECT T2.treatment_type_code, T1.treatment_type_description,  sum(cost_of_treatment) FROM Treatment_types AS T1 JOIN Treatments AS T2 ON T1.treatment_type_code  =  T2.treatment_type_code GROUP BY T1.treatment_type_code ORDER BY sum(cost_of_treatment) ASC LIMIT 1
SELECT T1.treatment_type_description FROM Treatment_types AS T1 JOIN Treatments AS T2 ON T1.treatment_type_code  =  T2.treatment_type_code GROUP BY T1.treatment_type_code ORDER BY sum(cost_of_treatment) ASC LIMIT 1
Final question: What is the description of the treatment type that costs the least money in total?
Final SQL: SELECT T1.treatment_type_description FROM Treatment_types AS T1 JOIN Treatments AS T2 ON T1.treatment_type_code  =  T2.treatment_type_code GROUP BY T1.treatment_type_code ORDER BY sum(cost_of_treatment) ASC LIMIT 1
Database: dog_kennels
Question sequence:
Show the dog name and total cost of each dog.
How many of them cost over 700?
Which owner paid the cost larger than 400, show the owner id and the zip code?
What about the owner who spent the largest cost?
SQL query sequence:
SELECT name, sum(cost_of_treatment) FROM Treatments AS T1 JOIN DOGS AS T2 ON T1.dog_id = T2.dog_id GROUP BY T1.dog_id
SELECT count(name) FROM Treatments AS T1 JOIN DOGS AS T2 ON T1.dog_id = T2.dog_id GROUP BY T1.dog_id Having sum(cost_of_treatment) > 700
SELECT T1.owner_id ,T1.zip_code FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id  =  T2.owner_id JOIN Treatments AS T3 ON T2.dog_id  =  T3.dog_id GROUP BY T1.owner_id Having sum(T3.cost_of_treatment) > 400
SELECT T1.owner_id ,  T1.zip_code FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id  =  T2.owner_id JOIN Treatments AS T3 ON T2.dog_id  =  T3.dog_id GROUP BY T1.owner_id ORDER BY sum(T3.cost_of_treatment) DESC LIMIT 1
Final question: Which owner has paid the largest amount of money in total for their dogs? Show the owner id and zip code.
Final SQL: SELECT T1.owner_id ,  T1.zip_code FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id  =  T2.owner_id JOIN Treatments AS T3 ON T2.dog_id  =  T3.dog_id GROUP BY T1.owner_id ORDER BY sum(T3.cost_of_treatment) DESC LIMIT 1
Database: dog_kennels
Question sequence:
List the professional first names and their types of treatments.
Add the counts of them also.
Among the results, who did only 1 type of treatment? List the professional ids and cell phone numbers of them.
What about at least two types of treatments?
SQL query sequence:
SELECT T1.first_name, T2.treatment_type_code FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id  =  T2.professional_id GROUP BY T1.professional_id
SELECT T1.first_name, T2.treatment_type_code, count(*) FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id  =  T2.professional_id GROUP BY T1.professional_id
SELECT T1.professional_id ,  T1.cell_number FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id  =  T2.professional_id GROUP BY T1.professional_id HAVING count(*)  = 1
SELECT T1.professional_id ,  T1.cell_number FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id  =  T2.professional_id GROUP BY T1.professional_id HAVING count(*)  >=  2
Final question: Which professionals have done at least two types of treatments? List the professional id and cell phone.
Final SQL: SELECT T1.professional_id ,  T1.cell_number FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id  =  T2.professional_id GROUP BY T1.professional_id HAVING count(*)  >=  2
Database: dog_kennels
Question sequence:
What is the minimum, maximum and average value of the treatment costs?
Which professionals who did the minimum value of the treatment cost? Provide the first name and last name.
What about the maximum cost?
How about below the average of the cost?
SQL query sequence:
SELECT min(cost_of_treatment), max(cost_of_treatment), avg(cost_of_treatment) FROM Treatments
SELECT DISTINCT T1.first_name ,  T1.last_name FROM Professionals AS T1 JOIN Treatments AS T2 WHERE cost_of_treatment  = ( SELECT min(cost_of_treatment) FROM Treatments )
SELECT DISTINCT T1.first_name ,  T1.last_name FROM Professionals AS T1 JOIN Treatments AS T2 WHERE cost_of_treatment  = ( SELECT max(cost_of_treatment) FROM Treatments )
SELECT DISTINCT T1.first_name ,  T1.last_name FROM Professionals AS T1 JOIN Treatments AS T2 WHERE cost_of_treatment  <  ( SELECT avg(cost_of_treatment) FROM Treatments )
Final question: What are the first name and last name of the professionals who have done treatment with cost below average?
Final SQL: SELECT DISTINCT T1.first_name ,  T1.last_name FROM Professionals AS T1 JOIN Treatments AS T2 WHERE cost_of_treatment  <  ( SELECT avg(cost_of_treatment) FROM Treatments )
Database: dog_kennels
Question sequence:
How many dogs for each breed code?
Which one is the most popular one?
What about the least popular one?
So which dogs are having the breed code? And the treatment dates?
SQL query sequence:
SELECT breed_code, count(*) FROM Dogs GROUP BY breed_code
SELECT breed_code, count(*) FROM Dogs GROUP BY breed_code Order BY count(*) DESC LIMIT 1
SELECT breed_code, count(*) FROM Dogs GROUP BY breed_code Order BY count(*) ASC LIMIT 1
SELECT T1.name ,  T2.date_of_treatment FROM Dogs AS T1 JOIN Treatments AS T2 ON T1.dog_id  =  T2.dog_id WHERE T1.breed_code  =  ( SELECT breed_code FROM Dogs GROUP BY breed_code ORDER BY count(*) ASC LIMIT 1 )
Final question: List the names of the dogs of the rarest breed and the treatment dates of them.
Final SQL: SELECT T1.name ,  T2.date_of_treatment FROM Dogs AS T1 JOIN Treatments AS T2 ON T1.dog_id  =  T2.dog_id WHERE T1.breed_code  =  ( SELECT breed_code FROM Dogs GROUP BY breed_code ORDER BY count(*) ASC LIMIT 1 )
Database: dog_kennels
Question sequence:
Show the name of dogs whose owners are from the city 'Lake Tia'.
Add the owner's first names also.
What about when the owner is from the state of 'Virginia'?
SQL query sequence:
SELECT T2.name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id  =  T2.owner_id WHERE T1.city  =  'Lake Tia'
SELECT T1.first_name, T2.name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id  =  T2.owner_id WHERE T1.city  =  'Lake Tia'
SELECT T1.first_name ,  T2.name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id  =  T2.owner_id WHERE T1.state  =  'Virginia'
Final question: Which dogs are owned by someone who lives in Virginia? List the owner's first name and the dog's name.
Final SQL: SELECT T1.first_name ,  T2.name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id  =  T2.owner_id WHERE T1.state  =  'Virginia'
Database: dog_kennels
Question sequence:
Which one is the oldest dog? List the information of it.
What are the last names of the oldest dogs?
What about the owner last name of the youngest dog?
SQL query sequence:
SELECT * FROM Dogs order by age asc limit 1
SELECT T1.last_name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id  =  T2.owner_id WHERE T2.age  =  ( SELECT max(age) FROM Dogs )
SELECT T1.last_name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id  =  T2.owner_id WHERE T2.age  =  ( SELECT min(age) FROM Dogs )
Final question: List the last name of the owner owning the youngest dog.
Final SQL: SELECT T1.last_name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id  =  T2.owner_id WHERE T2.age  =  ( SELECT min(age) FROM Dogs )
Database: dog_kennels
Question sequence:
Show the cities and states of the professionals.
How many of them are from 'Hawaii'?
List the emails of the professionals who live in the state of Hawaii or the state of Wisconsin.
SQL query sequence:
SELECT city, state FROM professionals
SELECT count(*) FROM professionals WHERE state = 'Hawaii'
SELECT email_address FROM Professionals WHERE state  =  'Hawaii' OR state  =  'Wisconsin'
Final question: List the emails of the professionals who live in the state of Hawaii or the state of Wisconsin.
Final SQL: SELECT email_address FROM Professionals WHERE state  =  'Hawaii' OR state  =  'Wisconsin'
Database: dog_kennels
Question sequence:
Show the states of the professionals.
How many of them are from 'Wisconsin'?
List the role code ,  street ,  city ,  state from the above results.
What about those professionals who live in a city containing the substring 'West'?
SQL query sequence:
SELECT state FROM professionals
SELECT count(*) FROM professionals WHERE state = 'Wisconsin'
SELECT role_code ,  street ,  city ,  state FROM professionals WHERE state = 'Wisconsin'
SELECT role_code ,  street ,  city ,  state FROM professionals WHERE city LIKE '%West%'
Final question: Which professionals live in a city containing the substring 'West'? List his or her role, street, city and state.
Final SQL: SELECT role_code ,  street ,  city ,  state FROM professionals WHERE city LIKE '%West%'
Database: dog_kennels
Question sequence:
Show the states of the owners.
How many of them are from 'Vermont'?
List the first name, last name and email of the owners who lives in the states that has the substring 'North'.
SQL query sequence:
SELECT state FROM Owners
SELECT count(*) FROM Owners WHERE state = 'Vermont'
SELECT first_name ,  last_name ,  email_address FROM Owners WHERE state LIKE '%North%'
Final question: Which owners live in the state whose name contains the substring 'North'? List his first name, last name and email.
Final SQL: SELECT first_name ,  last_name ,  email_address FROM Owners WHERE state LIKE '%North%'
Database: dog_kennels
Question sequence:
Order the dog ages in descending order.
How many of them are below 4?
What about the ones that are below the average?
SQL query sequence:
SELECT age FROM Dogs ORDER BY age
SELECT count(*) FROM Dogs WHERE age  < 4
SELECT count(*) FROM Dogs WHERE age  <  ( SELECT avg(age) FROM Dogs )
Final question: How many dogs have an age below the average?
Final SQL: SELECT count(*) FROM Dogs WHERE age  <  ( SELECT avg(age) FROM Dogs )
Database: dog_kennels
Question sequence:
Show the treatment details.
Order the cost in ascending order.
What about in descending order?
Which one is the most recent cost?
SQL query sequence:
SELECT * FROM Treatments
SELECT cost_of_treatment FROM Treatments ORDER BY cost_of_treatment ASC
SELECT cost_of_treatment FROM Treatments ORDER BY cost_of_treatment DESC
SELECT cost_of_treatment FROM Treatments ORDER BY date_of_treatment DESC LIMIT 1
Final question: How much does the most recent treatment cost?
Final SQL: SELECT cost_of_treatment FROM Treatments ORDER BY date_of_treatment DESC LIMIT 1
Database: dog_kennels
Question sequence:
Show all the owner information.
What about the dogs?
Among those, how many of them have been sent to receive treatment?
What about those who did not?
SQL query sequence:
SELECT * FROM Owners
SELECT count(*) FROM Dogs
SELECT count(*) FROM Dogs WHERE dog_id IN ( SELECT dog_id FROM Treatments )
SELECT count(*) FROM Dogs WHERE dog_id NOT IN ( SELECT dog_id FROM Treatments )
Final question: How many dogs have not gone through any treatment?
Final SQL: SELECT count(*) FROM Dogs WHERE dog_id NOT IN ( SELECT dog_id FROM Treatments )
Database: dog_kennels
Question sequence:
Show all the owner information.
How many of them come from the state of 'Arizona'?
What about those who do not have any dogs temporarily?
SQL query sequence:
SELECT * FROM Owners
SELECT count(*) FROM Owners WHERE state = 'Arizona'
SELECT count(*) FROM Owners WHERE owner_id NOT IN ( SELECT owner_id FROM Dogs )
Final question: How many owners temporarily do not have any dogs?
Final SQL: SELECT count(*) FROM Owners WHERE owner_id NOT IN ( SELECT owner_id FROM Dogs )
Database: dog_kennels
Question sequence:
How many professionals are there?
How many of them come from 'West Heidi?'
What about those who did not operate any treatment on dogs?
SQL query sequence:
SELECT count(*) FROM Professionals
SELECT count(*) FROM Professionals WHERE city = 'West Heidi'
SELECT count(*) FROM Professionals WHERE professional_id NOT IN ( SELECT professional_id FROM Treatments )
Final question: How many professionals did not operate any treatment on dogs?
Final SQL: SELECT count(*) FROM Professionals WHERE professional_id NOT IN ( SELECT professional_id FROM Treatments )