Unnamed: 0
int64 0
60k
| input
stringlengths 76
562
| answer
stringlengths 18
557
|
---|---|---|
4,400 |
<question>: What are names of countries with the top 3 largest population? <context>: CREATE TABLE country (Name VARCHAR, Population VARCHAR)
|
SELECT Name FROM country ORDER BY Population DESC LIMIT 3
|
4,401 |
<question>: What are the names of the nations with the 3 lowest populations? <context>: CREATE TABLE country (Name VARCHAR, Population VARCHAR)
|
SELECT Name FROM country ORDER BY Population LIMIT 3
|
4,402 |
<question>: how many countries are in Asia? <context>: CREATE TABLE country (continent VARCHAR)
|
SELECT COUNT(*) FROM country WHERE continent = "Asia"
|
4,403 |
<question>: What are the names of the countries that are in the continent of Europe and have a population of 80000? <context>: CREATE TABLE country (Name VARCHAR, continent VARCHAR, Population VARCHAR)
|
SELECT Name FROM country WHERE continent = "Europe" AND Population = "80000"
|
4,404 |
<question>: What is the total population and average area of countries in the continent of North America whose area is bigger than 3000 ? <context>: CREATE TABLE country (population INTEGER, surfacearea INTEGER, continent VARCHAR)
|
SELECT SUM(population), AVG(surfacearea) FROM country WHERE continent = "north america" AND surfacearea > 3000
|
4,405 |
<question>: What are the cities whose population is between 160000 and 900000? <context>: CREATE TABLE city (name VARCHAR, Population INTEGER)
|
SELECT name FROM city WHERE Population BETWEEN 160000 AND 900000
|
4,406 |
<question>: Return the names of cities that have a population between 160000 and 900000 . <context>: CREATE TABLE city (name VARCHAR, population INTEGER)
|
SELECT name FROM city WHERE population BETWEEN 160000 AND 900000
|
4,407 |
<question>: Which language is spoken by the largest number of countries? <context>: CREATE TABLE countrylanguage (LANGUAGE VARCHAR)
|
SELECT LANGUAGE FROM countrylanguage GROUP BY LANGUAGE ORDER BY COUNT(*) DESC LIMIT 1
|
4,408 |
<question>: What is the language spoken by the largest percentage of people in each country? <context>: CREATE TABLE countrylanguage (LANGUAGE VARCHAR, CountryCode VARCHAR, Percentage INTEGER)
|
SELECT LANGUAGE, CountryCode, MAX(Percentage) FROM countrylanguage GROUP BY CountryCode
|
4,409 |
<question>: What is the total number of countries where Spanish is spoken by the largest percentage of people? <context>: CREATE TABLE countrylanguage (Percentage INTEGER, CountryCode VARCHAR, LANGUAGE VARCHAR)
|
SELECT COUNT(*), MAX(Percentage) FROM countrylanguage WHERE LANGUAGE = "Spanish" GROUP BY CountryCode
|
4,410 |
<question>: What are the codes of countries where Spanish is spoken by the largest percentage of people? <context>: CREATE TABLE countrylanguage (CountryCode VARCHAR, Percentage INTEGER, LANGUAGE VARCHAR)
|
SELECT CountryCode, MAX(Percentage) FROM countrylanguage WHERE LANGUAGE = "Spanish" GROUP BY CountryCode
|
4,411 |
<question>: How many conductors are there? <context>: CREATE TABLE conductor (Id VARCHAR)
|
SELECT COUNT(*) FROM conductor
|
4,412 |
<question>: List the names of conductors in ascending order of age. <context>: CREATE TABLE conductor (Name VARCHAR, Age VARCHAR)
|
SELECT Name FROM conductor ORDER BY Age
|
4,413 |
<question>: What are the names of conductors whose nationalities are not "USA"? <context>: CREATE TABLE conductor (Name VARCHAR, Nationality VARCHAR)
|
SELECT Name FROM conductor WHERE Nationality <> 'USA'
|
4,414 |
<question>: What are the record companies of orchestras in descending order of years in which they were founded? <context>: CREATE TABLE orchestra (Record_Company VARCHAR, Year_of_Founded VARCHAR)
|
SELECT Record_Company FROM orchestra ORDER BY Year_of_Founded DESC
|
4,415 |
<question>: What is the average attendance of shows? <context>: CREATE TABLE SHOW (Attendance INTEGER)
|
SELECT AVG(Attendance) FROM SHOW
|
4,416 |
<question>: What are the maximum and minimum share of performances whose type is not "Live final". <context>: CREATE TABLE performance (SHARE INTEGER, TYPE VARCHAR)
|
SELECT MAX(SHARE), MIN(SHARE) FROM performance WHERE TYPE <> "Live final"
|
4,417 |
<question>: How many different nationalities do conductors have? <context>: CREATE TABLE conductor (Nationality VARCHAR)
|
SELECT COUNT(DISTINCT Nationality) FROM conductor
|
4,418 |
<question>: List names of conductors in descending order of years of work. <context>: CREATE TABLE conductor (Name VARCHAR, Year_of_Work VARCHAR)
|
SELECT Name FROM conductor ORDER BY Year_of_Work DESC
|
4,419 |
<question>: List the name of the conductor with the most years of work. <context>: CREATE TABLE conductor (Name VARCHAR, Year_of_Work VARCHAR)
|
SELECT Name FROM conductor ORDER BY Year_of_Work DESC LIMIT 1
|
4,420 |
<question>: Show the names of conductors and the orchestras they have conducted. <context>: CREATE TABLE conductor (Name VARCHAR, Conductor_ID VARCHAR); CREATE TABLE orchestra (Orchestra VARCHAR, Conductor_ID VARCHAR)
|
SELECT T1.Name, T2.Orchestra FROM conductor AS T1 JOIN orchestra AS T2 ON T1.Conductor_ID = T2.Conductor_ID
|
4,421 |
<question>: Show the names of conductors that have conducted more than one orchestras. <context>: CREATE TABLE orchestra (Conductor_ID VARCHAR); CREATE TABLE conductor (Name VARCHAR, Conductor_ID VARCHAR)
|
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
|
4,422 |
<question>: Show the name of the conductor that has conducted the most number of orchestras. <context>: CREATE TABLE orchestra (Conductor_ID VARCHAR); CREATE TABLE conductor (Name VARCHAR, Conductor_ID VARCHAR)
|
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
|
4,423 |
<question>: Please show the name of the conductor that has conducted orchestras founded after 2008. <context>: CREATE TABLE orchestra (Conductor_ID VARCHAR); CREATE TABLE conductor (Name VARCHAR, Conductor_ID VARCHAR)
|
SELECT T1.Name FROM conductor AS T1 JOIN orchestra AS T2 ON T1.Conductor_ID = T2.Conductor_ID WHERE Year_of_Founded > 2008
|
4,424 |
<question>: Please show the different record companies and the corresponding number of orchestras. <context>: CREATE TABLE orchestra (Record_Company VARCHAR)
|
SELECT Record_Company, COUNT(*) FROM orchestra GROUP BY Record_Company
|
4,425 |
<question>: Please show the record formats of orchestras in ascending order of count. <context>: CREATE TABLE orchestra (Major_Record_Format VARCHAR)
|
SELECT Major_Record_Format FROM orchestra GROUP BY Major_Record_Format ORDER BY COUNT(*)
|
4,426 |
<question>: List the record company shared by the most number of orchestras. <context>: CREATE TABLE orchestra (Record_Company VARCHAR)
|
SELECT Record_Company FROM orchestra GROUP BY Record_Company ORDER BY COUNT(*) DESC LIMIT 1
|
4,427 |
<question>: List the names of orchestras that have no performance. <context>: CREATE TABLE orchestra (Orchestra VARCHAR, Orchestra_ID VARCHAR); CREATE TABLE performance (Orchestra VARCHAR, Orchestra_ID VARCHAR)
|
SELECT Orchestra FROM orchestra WHERE NOT Orchestra_ID IN (SELECT Orchestra_ID FROM performance)
|
4,428 |
<question>: Show the record companies shared by orchestras founded before 2003 and after 2003. <context>: CREATE TABLE orchestra (Record_Company VARCHAR, Year_of_Founded INTEGER)
|
SELECT Record_Company FROM orchestra WHERE Year_of_Founded < 2003 INTERSECT SELECT Record_Company FROM orchestra WHERE Year_of_Founded > 2003
|
4,429 |
<question>: Find the number of orchestras whose record format is "CD" or "DVD". <context>: CREATE TABLE orchestra (Major_Record_Format VARCHAR)
|
SELECT COUNT(*) FROM orchestra WHERE Major_Record_Format = "CD" OR Major_Record_Format = "DVD"
|
4,430 |
<question>: Show the years in which orchestras that have given more than one performance are founded. <context>: CREATE TABLE performance (Orchestra_ID VARCHAR); CREATE TABLE orchestra (Orchestra_ID VARCHAR)
|
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
|
4,431 |
<question>: How many high schoolers are there? <context>: CREATE TABLE Highschooler (Id VARCHAR)
|
SELECT COUNT(*) FROM Highschooler
|
4,432 |
<question>: Show the names and grades of each high schooler. <context>: CREATE TABLE Highschooler (name VARCHAR, grade VARCHAR)
|
SELECT name, grade FROM Highschooler
|
4,433 |
<question>: Show all the grades of the high schoolers. <context>: CREATE TABLE Highschooler (grade VARCHAR)
|
SELECT grade FROM Highschooler
|
4,434 |
<question>: What grade is Kyle in? <context>: CREATE TABLE Highschooler (grade VARCHAR, name VARCHAR)
|
SELECT grade FROM Highschooler WHERE name = "Kyle"
|
4,435 |
<question>: Show the names of all high schoolers in grade 10. <context>: CREATE TABLE Highschooler (name VARCHAR, grade VARCHAR)
|
SELECT name FROM Highschooler WHERE grade = 10
|
4,436 |
<question>: Show the ID of the high schooler named Kyle. <context>: CREATE TABLE Highschooler (ID VARCHAR, name VARCHAR)
|
SELECT ID FROM Highschooler WHERE name = "Kyle"
|
4,437 |
<question>: How many high schoolers are there in grade 9 or 10? <context>: CREATE TABLE Highschooler (grade VARCHAR)
|
SELECT COUNT(*) FROM Highschooler WHERE grade = 9 OR grade = 10
|
4,438 |
<question>: Show the number of high schoolers for each grade. <context>: CREATE TABLE Highschooler (grade VARCHAR)
|
SELECT grade, COUNT(*) FROM Highschooler GROUP BY grade
|
4,439 |
<question>: Which grade has the most high schoolers? <context>: CREATE TABLE Highschooler (grade VARCHAR)
|
SELECT grade FROM Highschooler GROUP BY grade ORDER BY COUNT(*) DESC LIMIT 1
|
4,440 |
<question>: Show me all grades that have at least 4 students. <context>: CREATE TABLE Highschooler (grade VARCHAR)
|
SELECT grade FROM Highschooler GROUP BY grade HAVING COUNT(*) >= 4
|
4,441 |
<question>: Show the student IDs and numbers of friends corresponding to each. <context>: CREATE TABLE Friend (student_id VARCHAR)
|
SELECT student_id, COUNT(*) FROM Friend GROUP BY student_id
|
4,442 |
<question>: Show the names of high school students and their corresponding number of friends. <context>: CREATE TABLE Highschooler (name VARCHAR, id VARCHAR); CREATE TABLE Friend (student_id VARCHAR)
|
SELECT T2.name, COUNT(*) FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id
|
4,443 |
<question>: What is the name of the high schooler who has the greatest number of friends? <context>: CREATE TABLE Highschooler (name VARCHAR, id VARCHAR); CREATE TABLE Friend (student_id VARCHAR)
|
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
|
4,444 |
<question>: Show the names of high schoolers who have at least 3 friends. <context>: CREATE TABLE Highschooler (name VARCHAR, id VARCHAR); CREATE TABLE Friend (student_id VARCHAR)
|
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
|
4,445 |
<question>: Show the names of all of the high schooler Kyle's friends. <context>: CREATE TABLE Highschooler (name VARCHAR, id VARCHAR); CREATE TABLE Friend (student_id VARCHAR, friend_id VARCHAR); CREATE TABLE Highschooler (id VARCHAR, name VARCHAR)
|
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"
|
4,446 |
<question>: How many friends does the high school student Kyle have? <context>: CREATE TABLE Friend (student_id VARCHAR); CREATE TABLE Highschooler (id VARCHAR, name VARCHAR)
|
SELECT COUNT(*) FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id WHERE T2.name = "Kyle"
|
4,447 |
<question>: Show ids of all students who do not have any friends. <context>: CREATE TABLE Highschooler (id VARCHAR, student_id VARCHAR); CREATE TABLE Friend (id VARCHAR, student_id VARCHAR)
|
SELECT id FROM Highschooler EXCEPT SELECT student_id FROM Friend
|
4,448 |
<question>: Show names of all high school students who do not have any friends. <context>: CREATE TABLE Highschooler (name VARCHAR, id VARCHAR); CREATE TABLE Highschooler (name VARCHAR); CREATE TABLE Friend (student_id VARCHAR)
|
SELECT name FROM Highschooler EXCEPT SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id
|
4,449 |
<question>: Show the ids of high schoolers who have friends and are also liked by someone else. <context>: CREATE TABLE Likes (student_id VARCHAR, liked_id VARCHAR); CREATE TABLE Friend (student_id VARCHAR, liked_id VARCHAR)
|
SELECT student_id FROM Friend INTERSECT SELECT liked_id FROM Likes
|
4,450 |
<question>: Show name of all students who have some friends and also are liked by someone else. <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)
|
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
|
4,451 |
<question>: Count the number of likes for each student id. <context>: CREATE TABLE Likes (student_id VARCHAR)
|
SELECT student_id, COUNT(*) FROM Likes GROUP BY student_id
|
4,452 |
<question>: Show the names of high schoolers who have likes, and numbers of likes for each. <context>: CREATE TABLE Likes (student_id VARCHAR); CREATE TABLE Highschooler (name VARCHAR, id VARCHAR)
|
SELECT T2.name, COUNT(*) FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id
|
4,453 |
<question>: What is the name of the high schooler who has the greatest number of likes? <context>: CREATE TABLE Likes (student_id VARCHAR); CREATE TABLE Highschooler (name VARCHAR, id VARCHAR)
|
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
|
4,454 |
<question>: Show the names of students who have at least 2 likes. <context>: CREATE TABLE Likes (student_id VARCHAR); CREATE TABLE Highschooler (name VARCHAR, id VARCHAR)
|
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
|
4,455 |
<question>: Show the names of students who have a grade higher than 5 and have at least 2 friends. <context>: CREATE TABLE Friend (student_id VARCHAR); CREATE TABLE Highschooler (name VARCHAR, id VARCHAR, grade INTEGER)
|
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
|
4,456 |
<question>: How many likes does Kyle have? <context>: CREATE TABLE Likes (student_id VARCHAR); CREATE TABLE Highschooler (id VARCHAR, name VARCHAR)
|
SELECT COUNT(*) FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id WHERE T2.name = "Kyle"
|
4,457 |
<question>: Find the average grade of all students who have some friends. <context>: CREATE TABLE Highschooler (id VARCHAR); CREATE TABLE Friend (student_id VARCHAR); CREATE TABLE Highschooler (grade INTEGER, id VARCHAR)
|
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)
|
4,458 |
<question>: Find the minimum grade of students who have no friends. <context>: CREATE TABLE Highschooler (id VARCHAR); CREATE TABLE Friend (student_id VARCHAR); CREATE TABLE Highschooler (grade INTEGER, id VARCHAR)
|
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)
|
4,459 |
<question>: Which states have both owners and professionals living there? <context>: CREATE TABLE Owners (state VARCHAR); CREATE TABLE Professionals (state VARCHAR)
|
SELECT state FROM Owners INTERSECT SELECT state FROM Professionals
|
4,460 |
<question>: What is the average age of the dogs who have gone through any treatments? <context>: CREATE TABLE Dogs (age INTEGER, dog_id VARCHAR); CREATE TABLE Treatments (age INTEGER, dog_id VARCHAR)
|
SELECT AVG(age) FROM Dogs WHERE dog_id IN (SELECT dog_id FROM Treatments)
|
4,461 |
<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. <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)
|
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
|
4,462 |
<question>: Which dogs have not cost their owner more than 1000 for treatment ? List the dog names . <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)
|
SELECT name FROM dogs WHERE NOT dog_id IN (SELECT dog_id FROM treatments GROUP BY dog_id HAVING SUM(cost_of_treatment) > 1000)
|
4,463 |
<question>: Which first names are used for professionals or owners but are not used as dog names? <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)
|
SELECT first_name FROM Professionals UNION SELECT first_name FROM Owners EXCEPT SELECT name FROM Dogs
|
4,464 |
<question>: Which professional did not operate any treatment on dogs? List the professional's id, role and email. <context>: CREATE TABLE Professionals (professional_id VARCHAR, role_code VARCHAR, email_address VARCHAR); CREATE TABLE Treatments (professional_id VARCHAR)
|
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
|
4,465 |
<question>: Which owner owns the most dogs? List the owner id, first name and last name. <context>: CREATE TABLE Owners (first_name VARCHAR, last_name VARCHAR, owner_id VARCHAR); CREATE TABLE Dogs (owner_id VARCHAR)
|
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
|
4,466 |
<question>: Which professionals have done at least two treatments? List the professional's id, role, and first name. <context>: CREATE TABLE Professionals (professional_id VARCHAR, role_code VARCHAR, first_name VARCHAR); CREATE TABLE Treatments (professional_id VARCHAR)
|
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
|
4,467 |
<question>: What is the name of the breed with the most dogs? <context>: CREATE TABLE Dogs (breed_code VARCHAR); CREATE TABLE Breeds (breed_name VARCHAR, breed_code VARCHAR)
|
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
|
4,468 |
<question>: Which owner has paid for the most treatments on his or her dogs? List the owner id and last name. <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)
|
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
|
4,469 |
<question>: What is the description of the treatment type that costs the least money in total? <context>: CREATE TABLE Treatments (treatment_type_code VARCHAR); CREATE TABLE Treatment_types (treatment_type_description VARCHAR, treatment_type_code VARCHAR)
|
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
|
4,470 |
<question>: Which owner has paid the largest amount of money in total for their dogs? Show the owner id and zip code. <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)
|
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
|
4,471 |
<question>: Which professionals have done at least two types of treatments? List the professional id and cell phone. <context>: CREATE TABLE Professionals (professional_id VARCHAR, cell_number VARCHAR); CREATE TABLE Treatments (professional_id VARCHAR)
|
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
|
4,472 |
<question>: What are the first name and last name of the professionals who have done treatment with cost below average? <context>: CREATE TABLE Treatments (cost_of_treatment INTEGER); CREATE TABLE Professionals (first_name VARCHAR, last_name VARCHAR); CREATE TABLE Treatments (Id VARCHAR)
|
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)
|
4,473 |
<question>: List the date of each treatment, together with the first name of the professional who operated it. <context>: CREATE TABLE Treatments (date_of_treatment VARCHAR, professional_id VARCHAR); CREATE TABLE Professionals (first_name VARCHAR, professional_id VARCHAR)
|
SELECT T1.date_of_treatment, T2.first_name FROM Treatments AS T1 JOIN Professionals AS T2 ON T1.professional_id = T2.professional_id
|
4,474 |
<question>: List the cost of each treatment and the corresponding treatment type description. <context>: CREATE TABLE Treatments (cost_of_treatment VARCHAR, treatment_type_code VARCHAR); CREATE TABLE treatment_types (treatment_type_description VARCHAR, treatment_type_code VARCHAR)
|
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
|
4,475 |
<question>: List each owner's first name, last name, and the size of his for her dog. <context>: CREATE TABLE Owners (first_name VARCHAR, last_name VARCHAR, owner_id VARCHAR); CREATE TABLE Dogs (size_code VARCHAR, owner_id VARCHAR)
|
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
|
4,476 |
<question>: List pairs of the owner's first name and the dogs's name. <context>: CREATE TABLE Dogs (name VARCHAR, owner_id VARCHAR); CREATE TABLE Owners (first_name VARCHAR, owner_id VARCHAR)
|
SELECT T1.first_name, T2.name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id
|
4,477 |
<question>: List the names of the dogs of the rarest breed and the treatment dates of them. <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)
|
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)
|
4,478 |
<question>: Which dogs are owned by someone who lives in Virginia? List the owner's first name and the dog's name. <context>: CREATE TABLE Dogs (name VARCHAR, owner_id VARCHAR); CREATE TABLE Owners (first_name VARCHAR, owner_id VARCHAR, state VARCHAR)
|
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'
|
4,479 |
<question>: What are the arriving date and the departing date of the dogs who have gone through a treatment? <context>: CREATE TABLE Dogs (date_arrived VARCHAR, date_departed VARCHAR, dog_id VARCHAR); CREATE TABLE Treatments (dog_id VARCHAR)
|
SELECT DISTINCT T1.date_arrived, T1.date_departed FROM Dogs AS T1 JOIN Treatments AS T2 ON T1.dog_id = T2.dog_id
|
4,480 |
<question>: List the last name of the owner owning the youngest dog. <context>: CREATE TABLE Owners (last_name VARCHAR, owner_id VARCHAR); CREATE TABLE Dogs (owner_id VARCHAR, age INTEGER); CREATE TABLE Dogs (age INTEGER)
|
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)
|
4,481 |
<question>: List the emails of the professionals who live in the state of Hawaii or the state of Wisconsin. <context>: CREATE TABLE Professionals (email_address VARCHAR, state VARCHAR)
|
SELECT email_address FROM Professionals WHERE state = 'Hawaii' OR state = 'Wisconsin'
|
4,482 |
<question>: What are the arriving date and the departing date of all the dogs? <context>: CREATE TABLE Dogs (date_arrived VARCHAR, date_departed VARCHAR)
|
SELECT date_arrived, date_departed FROM Dogs
|
4,483 |
<question>: How many dogs went through any treatments? <context>: CREATE TABLE Treatments (dog_id VARCHAR)
|
SELECT COUNT(DISTINCT dog_id) FROM Treatments
|
4,484 |
<question>: How many professionals have performed any treatment to dogs? <context>: CREATE TABLE Treatments (professional_id VARCHAR)
|
SELECT COUNT(DISTINCT professional_id) FROM Treatments
|
4,485 |
<question>: Which professionals live in a city containing the substring 'West'? List his or her role, street, city and state. <context>: CREATE TABLE professionals (role_code VARCHAR, street VARCHAR, city VARCHAR, state VARCHAR)
|
SELECT role_code, street, city, state FROM professionals WHERE city LIKE '%West%'
|
4,486 |
<question>: Which owners live in the state whose name contains the substring 'North'? List his first name, last name and email. <context>: CREATE TABLE Owners (first_name VARCHAR, last_name VARCHAR, email_address VARCHAR, state VARCHAR)
|
SELECT first_name, last_name, email_address FROM Owners WHERE state LIKE '%North%'
|
4,487 |
<question>: How many dogs have an age below the average? <context>: CREATE TABLE Dogs (age INTEGER)
|
SELECT COUNT(*) FROM Dogs WHERE age < (SELECT AVG(age) FROM Dogs)
|
4,488 |
<question>: How much does the most recent treatment cost? <context>: CREATE TABLE Treatments (cost_of_treatment VARCHAR, date_of_treatment VARCHAR)
|
SELECT cost_of_treatment FROM Treatments ORDER BY date_of_treatment DESC LIMIT 1
|
4,489 |
<question>: How many dogs have not gone through any treatment? <context>: CREATE TABLE Dogs (dog_id VARCHAR); CREATE TABLE Treatments (dog_id VARCHAR)
|
SELECT COUNT(*) FROM Dogs WHERE NOT dog_id IN (SELECT dog_id FROM Treatments)
|
4,490 |
<question>: Tell me the number of dogs that have not received any treatment . <context>: CREATE TABLE treatments (dog_id VARCHAR); CREATE TABLE dogs (dog_id VARCHAR)
|
SELECT COUNT(*) FROM dogs WHERE NOT dog_id IN (SELECT dog_id FROM treatments)
|
4,491 |
<question>: How many owners temporarily do not have any dogs? <context>: CREATE TABLE Dogs (owner_id VARCHAR); CREATE TABLE Owners (owner_id VARCHAR)
|
SELECT COUNT(*) FROM Owners WHERE NOT owner_id IN (SELECT owner_id FROM Dogs)
|
4,492 |
<question>: How many professionals did not operate any treatment on dogs? <context>: CREATE TABLE Professionals (professional_id VARCHAR); CREATE TABLE Treatments (professional_id VARCHAR)
|
SELECT COUNT(*) FROM Professionals WHERE NOT professional_id IN (SELECT professional_id FROM Treatments)
|
4,493 |
<question>: List the dog name, age and weight of the dogs who have been abandoned? 1 stands for yes, and 0 stands for no. <context>: CREATE TABLE Dogs (name VARCHAR, age VARCHAR, weight VARCHAR, abandoned_yn VARCHAR)
|
SELECT name, age, weight FROM Dogs WHERE abandoned_yn = 1
|
4,494 |
<question>: What is the average age of all the dogs? <context>: CREATE TABLE Dogs (age INTEGER)
|
SELECT AVG(age) FROM Dogs
|
4,495 |
<question>: What is the age of the oldest dog? <context>: CREATE TABLE Dogs (age INTEGER)
|
SELECT MAX(age) FROM Dogs
|
4,496 |
<question>: How much does each charge type costs? List both charge type and amount. <context>: CREATE TABLE Charges (charge_type VARCHAR, charge_amount VARCHAR)
|
SELECT charge_type, charge_amount FROM Charges
|
4,497 |
<question>: How much does the most expensive charge type costs? <context>: CREATE TABLE Charges (charge_amount INTEGER)
|
SELECT MAX(charge_amount) FROM Charges
|
4,498 |
<question>: List the email, cell phone and home phone of all the professionals. <context>: CREATE TABLE professionals (email_address VARCHAR, cell_number VARCHAR, home_phone VARCHAR)
|
SELECT email_address, cell_number, home_phone FROM professionals
|
4,499 |
<question>: What are all the possible breed type and size type combinations? <context>: CREATE TABLE dogs (breed_code VARCHAR, size_code VARCHAR)
|
SELECT DISTINCT breed_code, size_code FROM dogs
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.