spiderology / testsets /having_in_sql /markup_having_in_sql.csv
k8-dmi3eva's picture
[NEW]: Upload test-sets
cdc1cad verified
db_id,question,query,simple_question,simple_query,source
battle_death,What are the ids and names of the battles that led to more than 10 people killed in total.,"SELECT T1.id , T1.name FROM battle AS T1 JOIN ship AS T2 ON T1.id = T2.lost_in_battle JOIN death AS T3 ON T2.id = T3.caused_by_ship_id GROUP BY T1.id HAVING sum(T3.killed) > 10",What are the ids and names of the battles.,"SELECT id , name FROM battle",spider-dev
car_1,What are the countries having at least one car maker? List name and id.,"SELECT T1.CountryName , T1.CountryId FROM COUNTRIES AS T1 JOIN CAR_MAKERS AS T2 ON T1.CountryId = T2.Country GROUP BY T1.CountryId HAVING count(*) >= 1;",What are the countries? List name and id.,"SELECT CountryName , CountryId FROM COUNTRIES",spider-dev
car_1,What are the names and ids of all countries with at least one car maker?,"SELECT T1.CountryName , T1.CountryId FROM COUNTRIES AS T1 JOIN CAR_MAKERS AS T2 ON T1.CountryId = T2.Country GROUP BY T1.CountryId HAVING count(*) >= 1;",What are the names and ids of all countries?,"SELECT CountryName , CountryId FROM COUNTRIES",spider-dev
course_teach,Show the hometowns shared by at least two teachers.,SELECT Hometown FROM teacher GROUP BY Hometown HAVING COUNT(*) >= 2,Show the hometowns of teachers,SELECT Hometown FROM teacher,spider-dev
course_teach,What are the towns from which at least two teachers come from?,SELECT Hometown FROM teacher GROUP BY Hometown HAVING COUNT(*) >= 2,What are the towns from which teachers come from?,SELECT Hometown FROM teacher,spider-dev
course_teach,Show names of teachers that teach at least two courses.,SELECT T2.Name FROM course_arrange AS T1 JOIN teacher AS T2 ON T1.Teacher_ID = T2.Teacher_ID GROUP BY T2.Name HAVING COUNT(*) >= 2,Show names of teachers.,SELECT Name FROM teacher,spider-dev
course_teach,What are the names of the teachers who teach at least two courses?,SELECT T2.Name FROM course_arrange AS T1 JOIN teacher AS T2 ON T1.Teacher_ID = T2.Teacher_ID GROUP BY T2.Name HAVING COUNT(*) >= 2,What are the names of the teachers?,SELECT Name FROM teacher,spider-dev
dog_kennels,"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.","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","Which professionals live in the state of Indiana? List his or her id, last name and cell phone.","SELECT professional_id , last_name , cell_number FROM Professionals WHERE state = 'Indiana'",spider-dev
dog_kennels,"Find the id, last name and cell phone of the professionals who live in the state of Indiana or have performed more than two treatments.","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","Find the id, last name and cell phone of the professionals who live in the state of Indiana.","SELECT professional_id , last_name , cell_number FROM Professionals WHERE state = 'Indiana'",spider-dev
dog_kennels,What are the names of the dogs for which the owner has not spend more than 1000 for treatment ?,select name from dogs where dog_id not in ( select dog_id from treatments group by dog_id having sum(cost_of_treatment) > 1000 ),What are the names of the dogs?,select name from dogs,spider-dev
dog_kennels,Find the id and cell phone of the professionals who operate two or more types of treatments.,"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",Find the id and cell phone of the professionals.,"SELECT professional_id , cell_number FROM Professionals",spider-dev
flight_2,Find all airlines that have at least 10 flights.,SELECT T1.Airline FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T1.uid = T2.Airline GROUP BY T1.Airline HAVING count(*) > 10,Find all airlines.,SELECT Airline FROM AIRLINES,spider-dev
museum_visit,"find the id, name and age for visitors who visited some museums more than once.","SELECT t1.id , t1.name , t1.age FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id GROUP BY t1.id HAVING count(*) > 1","find the id, name and age for visitors.","SELECT id , name , age FROM visitor",spider-dev
network_1,Show me all grades that have at least 4 students.,SELECT grade FROM Highschooler GROUP BY grade HAVING count(*) >= 4,Show me all grades.,SELECT grade FROM Highschooler,spider-dev
pets_1,Find the first name and gender of student who have more than one pet.,"SELECT T1.fname , T1.sex FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid GROUP BY T1.stuid HAVING count(*) > 1",Find the first name and gender of student.,"SELECT fname , sex FROM student",spider-dev
pets_1,What is the first name and gender of the all the students who have more than one pet?,"SELECT T1.fname , T1.sex FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid GROUP BY T1.stuid HAVING count(*) > 1",What is the first name and gender of the all the students,"SELECT fname , sex FROM student",spider-dev
poker_player,What are the nationalities that are shared by at least two people?,SELECT Nationality FROM people GROUP BY Nationality HAVING COUNT(*) >= 2,What are the nationalities?,SELECT Nationality FROM people,spider-dev
poker_player,Return the nationalities for which there are two or more people.,SELECT Nationality FROM people GROUP BY Nationality HAVING COUNT(*) >= 2,Return the nationalities.,SELECT Nationality FROM people,spider-dev
tvshow,find id of the tv channels that from the countries where have more than two tv channels.,SELECT id FROM tv_channel GROUP BY country HAVING count(*) > 2,find id of the tv channels.,SELECT id FROM tv_channel,spider-dev
tvshow,What are the ids of all tv channels that have more than 2 TV channels?,SELECT id FROM tv_channel GROUP BY country HAVING count(*) > 2,What are the ids of all tv channels?,SELECT id FROM tv_channel,spider-dev
wta_1,Find the name of tourney that has more than 10 matches.,SELECT tourney_name FROM matches GROUP BY tourney_name HAVING count(*) > 10,Find the name of tourney.,SELECT tourney_name FROM matches,spider-dev
wta_1,What are the names of tournaments that have more than 10 matches?,SELECT tourney_name FROM matches GROUP BY tourney_name HAVING count(*) > 10,What are the names of tournaments?,SELECT tourney_name FROM matches,spider-dev
wta_1,Find the codes of countries that have more than 50 players.,SELECT country_code FROM players GROUP BY country_code HAVING count(*) > 50,Find the codes of countries.,SELECT country_code FROM players,spider-dev
wta_1,What are the codes of countries with more than 50 players?,SELECT country_code FROM players GROUP BY country_code HAVING count(*) > 50,What are the codes of countries?,SELECT country_code FROM players,spider-dev
aircraft,List the names of aircrafts and that won matches at least twice.,SELECT T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft HAVING COUNT(*) >= 2,List the names of aircrafts.,SELECT Aircraft FROM aircraft,spider-train
aircraft,What are the names of all aircrafts that have won a match at least twice?,SELECT T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft HAVING COUNT(*) >= 2,What are the names of all aircrafts that have won a match at least twice?,SELECT Aircraft FROM aircraft ,spider-train
allergy_1,Show all student IDs who have at least two allergies.,SELECT StuID FROM Has_allergy GROUP BY StuID HAVING count(*) >= 2,Show all student IDs.,SELECT StuID FROM Has_allergy,spider-train
allergy_1,What are the students ids of students who have more than one allergy?,SELECT StuID FROM Has_allergy GROUP BY StuID HAVING count(*) >= 2,What are the students ids?,SELECT StuID FROM Has_allergy,spider-train
architecture,What are the ids and names of the architects who built at least 3 bridges ?,"SELECT T1.id , T1.name FROM architect AS T1 JOIN bridge AS T2 ON T1.id = T2.architect_id GROUP BY T1.id HAVING count(*) >= 3",What are the ids and names of the architects?,"SELECT id , name FROM architect",spider-train
architecture,"What are the ids, names and genders of the architects who built two bridges or one mill?","SELECT T1.id , T1.name , T1.gender FROM architect AS T1 JOIN bridge AS T2 ON T1.id = T2.architect_id GROUP BY T1.id HAVING count(*) = 2 UNION SELECT T1.id , T1.name , T1.gender FROM architect AS T1 JOIN mill AS T2 ON T1.id = T2.architect_id GROUP BY T1.id HAVING count(*) = 1","What are the ids, names and genders of the architects?","SELECT id , name , gender FROM architect ",spider-train