text
stringlengths
114
1.06k
### question: What are names of countries with the top 3 largest population? ### answer: SELECT Name FROM country ORDER BY Population DESC LIMIT 3 ### context: CREATE TABLE country (Name VARCHAR, Population VARCHAR)
### question: What are the names of the nations with the 3 lowest populations? ### answer: SELECT Name FROM country ORDER BY Population LIMIT 3 ### context: CREATE TABLE country (Name VARCHAR, Population VARCHAR)
### question: how many countries are in Asia? ### answer: SELECT COUNT(*) FROM country WHERE continent = "Asia" ### context: CREATE TABLE country (continent VARCHAR)
### question: What are the names of the countries that are in the continent of Europe and have a population of 80000? ### answer: SELECT Name FROM country WHERE continent = "Europe" AND Population = "80000" ### context: CREATE TABLE country (Name VARCHAR, continent VARCHAR, Population VARCHAR)
### question: What is the total population and average area of countries in the continent of North America whose area is bigger than 3000 ? ### answer: SELECT SUM(population), AVG(surfacearea) FROM country WHERE continent = "north america" AND surfacearea > 3000 ### context: CREATE TABLE country (population INTEGER, surfacearea INTEGER, continent VARCHAR)
### question: What are the cities whose population is between 160000 and 900000? ### answer: SELECT name FROM city WHERE Population BETWEEN 160000 AND 900000 ### context: CREATE TABLE city (name VARCHAR, Population INTEGER)
### question: Return the names of cities that have a population between 160000 and 900000 . ### answer: SELECT name FROM city WHERE population BETWEEN 160000 AND 900000 ### context: CREATE TABLE city (name VARCHAR, population INTEGER)
### question: Which language is spoken by the largest number of countries? ### answer: SELECT LANGUAGE FROM countrylanguage GROUP BY LANGUAGE ORDER BY COUNT(*) DESC LIMIT 1 ### context: CREATE TABLE countrylanguage (LANGUAGE VARCHAR)
### question: What is the language spoken by the largest percentage of people in each country? ### answer: SELECT LANGUAGE, CountryCode, MAX(Percentage) FROM countrylanguage GROUP BY CountryCode ### context: CREATE TABLE countrylanguage (LANGUAGE VARCHAR, CountryCode VARCHAR, Percentage INTEGER)
### question: What is the total number of countries where Spanish is spoken by the largest percentage of people? ### answer: SELECT COUNT(*), MAX(Percentage) FROM countrylanguage WHERE LANGUAGE = "Spanish" GROUP BY CountryCode ### context: CREATE TABLE countrylanguage (Percentage INTEGER, CountryCode VARCHAR, LANGUAGE VARCHAR)
### question: What are the codes of countries where Spanish is spoken by the largest percentage of people? ### answer: SELECT CountryCode, MAX(Percentage) FROM countrylanguage WHERE LANGUAGE = "Spanish" GROUP BY CountryCode ### context: CREATE TABLE countrylanguage (CountryCode VARCHAR, Percentage INTEGER, LANGUAGE VARCHAR)
### question: How many conductors are there? ### answer: SELECT COUNT(*) FROM conductor ### context: CREATE TABLE conductor (Id VARCHAR)
### question: List the names of conductors in ascending order of age. ### answer: SELECT Name FROM conductor ORDER BY Age ### context: CREATE TABLE conductor (Name VARCHAR, Age VARCHAR)
### question: What are the names of conductors whose nationalities are not "USA"? ### answer: SELECT Name FROM conductor WHERE Nationality <> 'USA' ### context: CREATE TABLE conductor (Name VARCHAR, Nationality VARCHAR)
### question: What are the record companies of orchestras in descending order of years in which they were founded? ### answer: SELECT Record_Company FROM orchestra ORDER BY Year_of_Founded DESC ### context: CREATE TABLE orchestra (Record_Company VARCHAR, Year_of_Founded VARCHAR)
### question: What is the average attendance of shows? ### answer: SELECT AVG(Attendance) FROM SHOW ### context: CREATE TABLE SHOW (Attendance INTEGER)
### question: What are the maximum and minimum share of performances whose type is not "Live final". ### answer: SELECT MAX(SHARE), MIN(SHARE) FROM performance WHERE TYPE <> "Live final" ### context: CREATE TABLE performance (SHARE INTEGER, TYPE VARCHAR)
### question: How many different nationalities do conductors have? ### answer: SELECT COUNT(DISTINCT Nationality) FROM conductor ### context: CREATE TABLE conductor (Nationality VARCHAR)
### question: List names of conductors in descending order of years of work. ### answer: SELECT Name FROM conductor ORDER BY Year_of_Work DESC ### context: CREATE TABLE conductor (Name VARCHAR, Year_of_Work VARCHAR)
### question: List the name of the conductor with the most years of work. ### answer: SELECT Name FROM conductor ORDER BY Year_of_Work DESC LIMIT 1 ### context: CREATE TABLE conductor (Name VARCHAR, Year_of_Work VARCHAR)
### question: Show the names of conductors and the orchestras they have conducted. ### answer: SELECT T1.Name, T2.Orchestra FROM conductor AS T1 JOIN orchestra AS T2 ON T1.Conductor_ID = T2.Conductor_ID ### context: CREATE TABLE conductor (Name VARCHAR, Conductor_ID VARCHAR); CREATE TABLE orchestra (Orchestra VARCHAR, Conductor_ID VARCHAR)
### question: Show the names of conductors that have conducted more than one orchestras. ### answer: SELECT T1.Name FROM conductor AS T1 JOIN orchestra AS T2 ON T1.Conductor_ID = T2.Conductor_ID GROUP BY T2.Conductor_ID HAVING COUNT(*) > 1 ### context: CREATE TABLE orchestra (Conductor_ID VARCHAR); CREATE TABLE conductor (Name VARCHAR, Conductor_ID VARCHAR)
### question: Show the name of the conductor that has conducted the most number of orchestras. ### answer: SELECT T1.Name FROM conductor AS T1 JOIN orchestra AS T2 ON T1.Conductor_ID = T2.Conductor_ID GROUP BY T2.Conductor_ID ORDER BY COUNT(*) DESC LIMIT 1 ### context: CREATE TABLE orchestra (Conductor_ID VARCHAR); CREATE TABLE conductor (Name VARCHAR, Conductor_ID VARCHAR)
### question: Please show the name of the conductor that has conducted orchestras founded after 2008. ### answer: SELECT T1.Name FROM conductor AS T1 JOIN orchestra AS T2 ON T1.Conductor_ID = T2.Conductor_ID WHERE Year_of_Founded > 2008 ### context: CREATE TABLE orchestra (Conductor_ID VARCHAR); CREATE TABLE conductor (Name VARCHAR, Conductor_ID VARCHAR)
### question: Please show the different record companies and the corresponding number of orchestras. ### answer: SELECT Record_Company, COUNT(*) FROM orchestra GROUP BY Record_Company ### context: CREATE TABLE orchestra (Record_Company VARCHAR)
### question: Please show the record formats of orchestras in ascending order of count. ### answer: SELECT Major_Record_Format FROM orchestra GROUP BY Major_Record_Format ORDER BY COUNT(*) ### context: CREATE TABLE orchestra (Major_Record_Format VARCHAR)
### question: List the record company shared by the most number of orchestras. ### answer: SELECT Record_Company FROM orchestra GROUP BY Record_Company ORDER BY COUNT(*) DESC LIMIT 1 ### context: CREATE TABLE orchestra (Record_Company VARCHAR)
### question: List the names of orchestras that have no performance. ### answer: SELECT Orchestra FROM orchestra WHERE NOT Orchestra_ID IN (SELECT Orchestra_ID FROM performance) ### context: CREATE TABLE orchestra (Orchestra VARCHAR, Orchestra_ID VARCHAR); CREATE TABLE performance (Orchestra VARCHAR, Orchestra_ID VARCHAR)
### question: Show the record companies shared by orchestras founded before 2003 and after 2003. ### answer: SELECT Record_Company FROM orchestra WHERE Year_of_Founded < 2003 INTERSECT SELECT Record_Company FROM orchestra WHERE Year_of_Founded > 2003 ### context: CREATE TABLE orchestra (Record_Company VARCHAR, Year_of_Founded INTEGER)
### question: Find the number of orchestras whose record format is "CD" or "DVD". ### answer: SELECT COUNT(*) FROM orchestra WHERE Major_Record_Format = "CD" OR Major_Record_Format = "DVD" ### context: CREATE TABLE orchestra (Major_Record_Format VARCHAR)
### question: Show the years in which orchestras that have given more than one performance are founded. ### answer: SELECT Year_of_Founded FROM orchestra AS T1 JOIN performance AS T2 ON T1.Orchestra_ID = T2.Orchestra_ID GROUP BY T2.Orchestra_ID HAVING COUNT(*) > 1 ### context: CREATE TABLE performance (Orchestra_ID VARCHAR); CREATE TABLE orchestra (Orchestra_ID VARCHAR)
### question: How many high schoolers are there? ### answer: SELECT COUNT(*) FROM Highschooler ### context: CREATE TABLE Highschooler (Id VARCHAR)
### question: Show the names and grades of each high schooler. ### answer: SELECT name, grade FROM Highschooler ### context: CREATE TABLE Highschooler (name VARCHAR, grade VARCHAR)
### question: Show all the grades of the high schoolers. ### answer: SELECT grade FROM Highschooler ### context: CREATE TABLE Highschooler (grade VARCHAR)
### question: What grade is Kyle in? ### answer: SELECT grade FROM Highschooler WHERE name = "Kyle" ### context: CREATE TABLE Highschooler (grade VARCHAR, name VARCHAR)
### question: Show the names of all high schoolers in grade 10. ### answer: SELECT name FROM Highschooler WHERE grade = 10 ### context: CREATE TABLE Highschooler (name VARCHAR, grade VARCHAR)
### question: Show the ID of the high schooler named Kyle. ### answer: SELECT ID FROM Highschooler WHERE name = "Kyle" ### context: CREATE TABLE Highschooler (ID VARCHAR, name VARCHAR)
### question: How many high schoolers are there in grade 9 or 10? ### answer: SELECT COUNT(*) FROM Highschooler WHERE grade = 9 OR grade = 10 ### context: CREATE TABLE Highschooler (grade VARCHAR)
### question: Show the number of high schoolers for each grade. ### answer: SELECT grade, COUNT(*) FROM Highschooler GROUP BY grade ### context: CREATE TABLE Highschooler (grade VARCHAR)
### question: Which grade has the most high schoolers? ### answer: SELECT grade FROM Highschooler GROUP BY grade ORDER BY COUNT(*) DESC LIMIT 1 ### context: CREATE TABLE Highschooler (grade VARCHAR)
### question: Show me all grades that have at least 4 students. ### answer: SELECT grade FROM Highschooler GROUP BY grade HAVING COUNT(*) >= 4 ### context: CREATE TABLE Highschooler (grade VARCHAR)
### question: Show the student IDs and numbers of friends corresponding to each. ### answer: SELECT student_id, COUNT(*) FROM Friend GROUP BY student_id ### context: CREATE TABLE Friend (student_id VARCHAR)
### question: Show the names of high school students and their corresponding number of friends. ### answer: SELECT T2.name, COUNT(*) FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id ### context: CREATE TABLE Highschooler (name VARCHAR, id VARCHAR); CREATE TABLE Friend (student_id VARCHAR)
### question: What is the name of the high schooler who has the greatest number of friends? ### answer: SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id ORDER BY COUNT(*) DESC LIMIT 1 ### context: CREATE TABLE Highschooler (name VARCHAR, id VARCHAR); CREATE TABLE Friend (student_id VARCHAR)
### question: Show the names of high schoolers who have at least 3 friends. ### answer: SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id HAVING COUNT(*) >= 3 ### context: CREATE TABLE Highschooler (name VARCHAR, id VARCHAR); CREATE TABLE Friend (student_id VARCHAR)
### question: Show the names of all of the high schooler Kyle's friends. ### answer: SELECT T3.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id JOIN Highschooler AS T3 ON T1.friend_id = T3.id WHERE T2.name = "Kyle" ### context: CREATE TABLE Highschooler (name VARCHAR, id VARCHAR); CREATE TABLE Friend (student_id VARCHAR, friend_id VARCHAR); CREATE TABLE Highschooler (id VARCHAR, name VARCHAR)
### question: How many friends does the high school student Kyle have? ### answer: SELECT COUNT(*) FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id WHERE T2.name = "Kyle" ### context: CREATE TABLE Friend (student_id VARCHAR); CREATE TABLE Highschooler (id VARCHAR, name VARCHAR)
### question: Show ids of all students who do not have any friends. ### answer: SELECT id FROM Highschooler EXCEPT SELECT student_id FROM Friend ### context: CREATE TABLE Highschooler (id VARCHAR, student_id VARCHAR); CREATE TABLE Friend (id VARCHAR, student_id VARCHAR)
### question: Show names of all high school students who do not have any friends. ### answer: SELECT name FROM Highschooler EXCEPT SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id ### context: CREATE TABLE Highschooler (name VARCHAR, id VARCHAR); CREATE TABLE Highschooler (name VARCHAR); CREATE TABLE Friend (student_id VARCHAR)
### question: Show the ids of high schoolers who have friends and are also liked by someone else. ### answer: SELECT student_id FROM Friend INTERSECT SELECT liked_id FROM Likes ### context: CREATE TABLE Likes (student_id VARCHAR, liked_id VARCHAR); CREATE TABLE Friend (student_id VARCHAR, liked_id VARCHAR)
### question: Show name of all students who have some friends and also are liked by someone else. ### answer: SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id INTERSECT SELECT T2.name FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.liked_id = T2.id ### context: CREATE TABLE Highschooler (name VARCHAR, id VARCHAR); CREATE TABLE Likes (student_id VARCHAR, liked_id VARCHAR); CREATE TABLE Friend (student_id VARCHAR, liked_id VARCHAR)
### question: Count the number of likes for each student id. ### answer: SELECT student_id, COUNT(*) FROM Likes GROUP BY student_id ### context: CREATE TABLE Likes (student_id VARCHAR)
### question: Show the names of high schoolers who have likes, and numbers of likes for each. ### answer: SELECT T2.name, COUNT(*) FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id ### context: CREATE TABLE Likes (student_id VARCHAR); CREATE TABLE Highschooler (name VARCHAR, id VARCHAR)
### question: What is the name of the high schooler who has the greatest number of likes? ### answer: SELECT T2.name FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id ORDER BY COUNT(*) DESC LIMIT 1 ### context: CREATE TABLE Likes (student_id VARCHAR); CREATE TABLE Highschooler (name VARCHAR, id VARCHAR)
### question: Show the names of students who have at least 2 likes. ### answer: SELECT T2.name FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id HAVING COUNT(*) >= 2 ### context: CREATE TABLE Likes (student_id VARCHAR); CREATE TABLE Highschooler (name VARCHAR, id VARCHAR)
### question: Show the names of students who have a grade higher than 5 and have at least 2 friends. ### answer: SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id WHERE T2.grade > 5 GROUP BY T1.student_id HAVING COUNT(*) >= 2 ### context: CREATE TABLE Friend (student_id VARCHAR); CREATE TABLE Highschooler (name VARCHAR, id VARCHAR, grade INTEGER)
### question: How many likes does Kyle have? ### answer: SELECT COUNT(*) FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id WHERE T2.name = "Kyle" ### context: CREATE TABLE Likes (student_id VARCHAR); CREATE TABLE Highschooler (id VARCHAR, name VARCHAR)
### question: Find the average grade of all students who have some friends. ### answer: SELECT AVG(grade) FROM Highschooler WHERE id IN (SELECT T1.student_id FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id) ### context: CREATE TABLE Highschooler (id VARCHAR); CREATE TABLE Friend (student_id VARCHAR); CREATE TABLE Highschooler (grade INTEGER, id VARCHAR)
### question: Find the minimum grade of students who have no friends. ### answer: SELECT MIN(grade) FROM Highschooler WHERE NOT id IN (SELECT T1.student_id FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id) ### context: CREATE TABLE Highschooler (id VARCHAR); CREATE TABLE Friend (student_id VARCHAR); CREATE TABLE Highschooler (grade INTEGER, id VARCHAR)
### question: Which states have both owners and professionals living there? ### answer: SELECT state FROM Owners INTERSECT SELECT state FROM Professionals ### context: CREATE TABLE Owners (state VARCHAR); CREATE TABLE Professionals (state VARCHAR)
### question: What is the average age of the dogs who have gone through any treatments? ### answer: SELECT AVG(age) FROM Dogs WHERE dog_id IN (SELECT dog_id FROM Treatments) ### context: CREATE TABLE Dogs (age INTEGER, dog_id VARCHAR); CREATE TABLE Treatments (age INTEGER, dog_id VARCHAR)
### question: Which professionals live in the state of Indiana or have done treatment on more than 2 treatments? List his or her id, last name and cell phone. ### answer: SELECT professional_id, last_name, cell_number FROM Professionals WHERE state = 'Indiana' UNION SELECT T1.professional_id, T1.last_name, 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 ### context: CREATE TABLE Treatments (professional_id VARCHAR); CREATE TABLE Professionals (professional_id VARCHAR, last_name VARCHAR, cell_number VARCHAR); CREATE TABLE Professionals (professional_id VARCHAR, last_name VARCHAR, cell_number VARCHAR, state VARCHAR)
### question: Which dogs have not cost their owner more than 1000 for treatment ? List the dog names . ### answer: SELECT name FROM dogs WHERE NOT dog_id IN (SELECT dog_id FROM treatments GROUP BY dog_id HAVING SUM(cost_of_treatment) > 1000) ### context: CREATE TABLE dogs (name VARCHAR, dog_id VARCHAR, cost_of_treatment INTEGER); CREATE TABLE treatments (name VARCHAR, dog_id VARCHAR, cost_of_treatment INTEGER)
### question: Which first names are used for professionals or owners but are not used as dog names? ### answer: SELECT first_name FROM Professionals UNION SELECT first_name FROM Owners EXCEPT SELECT name FROM Dogs ### context: CREATE TABLE Owners (first_name VARCHAR, name VARCHAR); CREATE TABLE Dogs (first_name VARCHAR, name VARCHAR); CREATE TABLE Professionals (first_name VARCHAR, name VARCHAR)
### question: Which professional did not operate any treatment on dogs? List the professional's id, role and email. ### answer: 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 ### context: CREATE TABLE Professionals (professional_id VARCHAR, role_code VARCHAR, email_address VARCHAR); CREATE TABLE Treatments (professional_id VARCHAR)
### question: Which owner owns the most dogs? List the owner id, first name and last name. ### answer: 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 ### context: CREATE TABLE Owners (first_name VARCHAR, last_name VARCHAR, owner_id VARCHAR); CREATE TABLE Dogs (owner_id VARCHAR)
### question: Which professionals have done at least two treatments? List the professional's id, role, and first name. ### answer: 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 ### context: CREATE TABLE Professionals (professional_id VARCHAR, role_code VARCHAR, first_name VARCHAR); CREATE TABLE Treatments (professional_id VARCHAR)
### question: What is the name of the breed with the most dogs? ### answer: 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 ### context: CREATE TABLE Dogs (breed_code VARCHAR); CREATE TABLE Breeds (breed_name VARCHAR, breed_code VARCHAR)
### question: Which owner has paid for the most treatments on his or her dogs? List the owner id and last name. ### answer: 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 ### context: CREATE TABLE Owners (owner_id VARCHAR, last_name VARCHAR); CREATE TABLE Dogs (owner_id VARCHAR, dog_id VARCHAR); CREATE TABLE Treatments (dog_id VARCHAR)
### question: What is the description of the treatment type that costs the least money in total? ### answer: 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) LIMIT 1 ### context: CREATE TABLE Treatments (treatment_type_code VARCHAR); CREATE TABLE Treatment_types (treatment_type_description VARCHAR, treatment_type_code VARCHAR)
### question: Which owner has paid the largest amount of money in total for their dogs? Show the owner id and zip code. ### answer: 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 ### context: CREATE TABLE Treatments (dog_id VARCHAR, cost_of_treatment INTEGER); CREATE TABLE Owners (owner_id VARCHAR, zip_code VARCHAR); CREATE TABLE Dogs (owner_id VARCHAR, dog_id VARCHAR)
### question: Which professionals have done at least two types of treatments? List the professional id and cell phone. ### answer: 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 ### context: CREATE TABLE Professionals (professional_id VARCHAR, cell_number VARCHAR); CREATE TABLE Treatments (professional_id VARCHAR)
### question: What are the first name and last name of the professionals who have done treatment with cost below average? ### answer: 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) ### context: CREATE TABLE Treatments (cost_of_treatment INTEGER); CREATE TABLE Professionals (first_name VARCHAR, last_name VARCHAR); CREATE TABLE Treatments (Id VARCHAR)
### question: List the date of each treatment, together with the first name of the professional who operated it. ### answer: SELECT T1.date_of_treatment, T2.first_name FROM Treatments AS T1 JOIN Professionals AS T2 ON T1.professional_id = T2.professional_id ### context: CREATE TABLE Treatments (date_of_treatment VARCHAR, professional_id VARCHAR); CREATE TABLE Professionals (first_name VARCHAR, professional_id VARCHAR)
### question: List the cost of each treatment and the corresponding treatment type description. ### answer: SELECT T1.cost_of_treatment, T2.treatment_type_description FROM Treatments AS T1 JOIN treatment_types AS T2 ON T1.treatment_type_code = T2.treatment_type_code ### context: CREATE TABLE Treatments (cost_of_treatment VARCHAR, treatment_type_code VARCHAR); CREATE TABLE treatment_types (treatment_type_description VARCHAR, treatment_type_code VARCHAR)
### question: List each owner's first name, last name, and the size of his for her dog. ### answer: SELECT T1.first_name, T1.last_name, T2.size_code FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id ### context: CREATE TABLE Owners (first_name VARCHAR, last_name VARCHAR, owner_id VARCHAR); CREATE TABLE Dogs (size_code VARCHAR, owner_id VARCHAR)
### question: List pairs of the owner's first name and the dogs's name. ### answer: SELECT T1.first_name, T2.name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id ### context: CREATE TABLE Dogs (name VARCHAR, owner_id VARCHAR); CREATE TABLE Owners (first_name VARCHAR, owner_id VARCHAR)
### question: List the names of the dogs of the rarest breed and the treatment dates of them. ### answer: 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(*) LIMIT 1) ### context: CREATE TABLE Dogs (name VARCHAR, dog_id VARCHAR, breed_code VARCHAR); CREATE TABLE Treatments (date_of_treatment VARCHAR, dog_id VARCHAR); CREATE TABLE Dogs (breed_code VARCHAR)
### question: Which dogs are owned by someone who lives in Virginia? List the owner's first name and the dog's name. ### answer: 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' ### context: CREATE TABLE Dogs (name VARCHAR, owner_id VARCHAR); CREATE TABLE Owners (first_name VARCHAR, owner_id VARCHAR, state VARCHAR)
### question: What are the arriving date and the departing date of the dogs who have gone through a treatment? ### answer: SELECT DISTINCT T1.date_arrived, T1.date_departed FROM Dogs AS T1 JOIN Treatments AS T2 ON T1.dog_id = T2.dog_id ### context: CREATE TABLE Dogs (date_arrived VARCHAR, date_departed VARCHAR, dog_id VARCHAR); CREATE TABLE Treatments (dog_id VARCHAR)
### question: List the last name of the owner owning the youngest dog. ### answer: 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) ### context: CREATE TABLE Owners (last_name VARCHAR, owner_id VARCHAR); CREATE TABLE Dogs (owner_id VARCHAR, age INTEGER); CREATE TABLE Dogs (age INTEGER)
### question: List the emails of the professionals who live in the state of Hawaii or the state of Wisconsin. ### answer: SELECT email_address FROM Professionals WHERE state = 'Hawaii' OR state = 'Wisconsin' ### context: CREATE TABLE Professionals (email_address VARCHAR, state VARCHAR)
### question: What are the arriving date and the departing date of all the dogs? ### answer: SELECT date_arrived, date_departed FROM Dogs ### context: CREATE TABLE Dogs (date_arrived VARCHAR, date_departed VARCHAR)
### question: How many dogs went through any treatments? ### answer: SELECT COUNT(DISTINCT dog_id) FROM Treatments ### context: CREATE TABLE Treatments (dog_id VARCHAR)
### question: How many professionals have performed any treatment to dogs? ### answer: SELECT COUNT(DISTINCT professional_id) FROM Treatments ### context: CREATE TABLE Treatments (professional_id VARCHAR)
### question: Which professionals live in a city containing the substring 'West'? List his or her role, street, city and state. ### answer: SELECT role_code, street, city, state FROM professionals WHERE city LIKE '%West%' ### context: CREATE TABLE professionals (role_code VARCHAR, street VARCHAR, city VARCHAR, state VARCHAR)
### question: Which owners live in the state whose name contains the substring 'North'? List his first name, last name and email. ### answer: SELECT first_name, last_name, email_address FROM Owners WHERE state LIKE '%North%' ### context: CREATE TABLE Owners (first_name VARCHAR, last_name VARCHAR, email_address VARCHAR, state VARCHAR)
### question: How many dogs have an age below the average? ### answer: SELECT COUNT(*) FROM Dogs WHERE age < (SELECT AVG(age) FROM Dogs) ### context: CREATE TABLE Dogs (age INTEGER)
### question: How much does the most recent treatment cost? ### answer: SELECT cost_of_treatment FROM Treatments ORDER BY date_of_treatment DESC LIMIT 1 ### context: CREATE TABLE Treatments (cost_of_treatment VARCHAR, date_of_treatment VARCHAR)
### question: How many dogs have not gone through any treatment? ### answer: SELECT COUNT(*) FROM Dogs WHERE NOT dog_id IN (SELECT dog_id FROM Treatments) ### context: CREATE TABLE Dogs (dog_id VARCHAR); CREATE TABLE Treatments (dog_id VARCHAR)
### question: Tell me the number of dogs that have not received any treatment . ### answer: SELECT COUNT(*) FROM dogs WHERE NOT dog_id IN (SELECT dog_id FROM treatments) ### context: CREATE TABLE treatments (dog_id VARCHAR); CREATE TABLE dogs (dog_id VARCHAR)
### question: How many owners temporarily do not have any dogs? ### answer: SELECT COUNT(*) FROM Owners WHERE NOT owner_id IN (SELECT owner_id FROM Dogs) ### context: CREATE TABLE Dogs (owner_id VARCHAR); CREATE TABLE Owners (owner_id VARCHAR)
### question: How many professionals did not operate any treatment on dogs? ### answer: SELECT COUNT(*) FROM Professionals WHERE NOT professional_id IN (SELECT professional_id FROM Treatments) ### context: CREATE TABLE Professionals (professional_id VARCHAR); CREATE TABLE Treatments (professional_id VARCHAR)
### question: List the dog name, age and weight of the dogs who have been abandoned? 1 stands for yes, and 0 stands for no. ### answer: SELECT name, age, weight FROM Dogs WHERE abandoned_yn = 1 ### context: CREATE TABLE Dogs (name VARCHAR, age VARCHAR, weight VARCHAR, abandoned_yn VARCHAR)
### question: What is the average age of all the dogs? ### answer: SELECT AVG(age) FROM Dogs ### context: CREATE TABLE Dogs (age INTEGER)
### question: What is the age of the oldest dog? ### answer: SELECT MAX(age) FROM Dogs ### context: CREATE TABLE Dogs (age INTEGER)
### question: How much does each charge type costs? List both charge type and amount. ### answer: SELECT charge_type, charge_amount FROM Charges ### context: CREATE TABLE Charges (charge_type VARCHAR, charge_amount VARCHAR)
### question: How much does the most expensive charge type costs? ### answer: SELECT MAX(charge_amount) FROM Charges ### context: CREATE TABLE Charges (charge_amount INTEGER)
### question: List the email, cell phone and home phone of all the professionals. ### answer: SELECT email_address, cell_number, home_phone FROM professionals ### context: CREATE TABLE professionals (email_address VARCHAR, cell_number VARCHAR, home_phone VARCHAR)
### question: What are all the possible breed type and size type combinations? ### answer: SELECT DISTINCT breed_code, size_code FROM dogs ### context: CREATE TABLE dogs (breed_code VARCHAR, size_code VARCHAR)