db_name
stringclasses
146 values
prompt
stringlengths
310
4.81k
election
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # county ( County_Id, County_name, Population, Zip_code ) # party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate ) # election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee ) # # election.District can be joined with county.County_Id # election.Party can be joined with party.Party_ID # ### Question: # # Which committees have delegates from both democratic party and liberal party? # ### SQL: # # SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = "Democratic" INTERSECT SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = "Liberal" # ### End.
election
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # county ( County_Id, County_name, Population, Zip_code ) # party ( Party_ID, Year, Party, Governor, Lieutenant_Governor, Comptroller, Attorney_General, US_Senate ) # election ( Election_ID, Counties_Represented, District, Delegate, Party, First_Elected, Committee ) # # election.District can be joined with county.County_Id # election.Party can be joined with party.Party_ID # ### Question: # # Find the committees that have delegates both from from the democratic party and the liberal party. # ### SQL: # # SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = "Democratic" INTERSECT SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = "Liberal" # ### End.
news_report
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # event ( Event_ID, Date, Venue, Name, Event_Attendance ) # journalist ( journalist_ID, Name, Nationality, Age, Years_working ) # news_report ( journalist_ID, Event_ID, Work_Type ) # # news_report.Event_ID can be joined with event.Event_ID # news_report.journalist_ID can be joined with journalist.journalist_ID # ### Question: # # How many journalists are there? # ### SQL: # # SELECT count(*) FROM journalist # ### End.
news_report
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # event ( Event_ID, Date, Venue, Name, Event_Attendance ) # journalist ( journalist_ID, Name, Nationality, Age, Years_working ) # news_report ( journalist_ID, Event_ID, Work_Type ) # # news_report.Event_ID can be joined with event.Event_ID # news_report.journalist_ID can be joined with journalist.journalist_ID # ### Question: # # List the names of journalists in ascending order of years working. # ### SQL: # # SELECT Name FROM journalist ORDER BY Years_working ASC # ### End.
news_report
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # event ( Event_ID, Date, Venue, Name, Event_Attendance ) # journalist ( journalist_ID, Name, Nationality, Age, Years_working ) # news_report ( journalist_ID, Event_ID, Work_Type ) # # news_report.Event_ID can be joined with event.Event_ID # news_report.journalist_ID can be joined with journalist.journalist_ID # ### Question: # # What are the nationalities and ages of journalists? # ### SQL: # # SELECT Nationality , Age FROM journalist # ### End.
news_report
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # event ( Event_ID, Date, Venue, Name, Event_Attendance ) # journalist ( journalist_ID, Name, Nationality, Age, Years_working ) # news_report ( journalist_ID, Event_ID, Work_Type ) # # news_report.Event_ID can be joined with event.Event_ID # news_report.journalist_ID can be joined with journalist.journalist_ID # ### Question: # # Show the names of journalists from "England" or "Wales". # ### SQL: # # SELECT Name FROM journalist WHERE Nationality = "England" OR Nationality = "Wales" # ### End.
news_report
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # event ( Event_ID, Date, Venue, Name, Event_Attendance ) # journalist ( journalist_ID, Name, Nationality, Age, Years_working ) # news_report ( journalist_ID, Event_ID, Work_Type ) # # news_report.Event_ID can be joined with event.Event_ID # news_report.journalist_ID can be joined with journalist.journalist_ID # ### Question: # # What is the average number of years spent working as a journalist? # ### SQL: # # SELECT avg(Years_working) FROM journalist # ### End.
news_report
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # event ( Event_ID, Date, Venue, Name, Event_Attendance ) # journalist ( journalist_ID, Name, Nationality, Age, Years_working ) # news_report ( journalist_ID, Event_ID, Work_Type ) # # news_report.Event_ID can be joined with event.Event_ID # news_report.journalist_ID can be joined with journalist.journalist_ID # ### Question: # # What is the nationality of the journalist with the largest number of years working? # ### SQL: # # SELECT Nationality FROM journalist ORDER BY Years_working DESC LIMIT 1 # ### End.
news_report
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # event ( Event_ID, Date, Venue, Name, Event_Attendance ) # journalist ( journalist_ID, Name, Nationality, Age, Years_working ) # news_report ( journalist_ID, Event_ID, Work_Type ) # # news_report.Event_ID can be joined with event.Event_ID # news_report.journalist_ID can be joined with journalist.journalist_ID # ### Question: # # Show the different nationalities and the number of journalists of each nationality. # ### SQL: # # SELECT Nationality , COUNT(*) FROM journalist GROUP BY Nationality # ### End.
news_report
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # event ( Event_ID, Date, Venue, Name, Event_Attendance ) # journalist ( journalist_ID, Name, Nationality, Age, Years_working ) # news_report ( journalist_ID, Event_ID, Work_Type ) # # news_report.Event_ID can be joined with event.Event_ID # news_report.journalist_ID can be joined with journalist.journalist_ID # ### Question: # # Show the most common nationality for journalists. # ### SQL: # # SELECT Nationality FROM journalist GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1 # ### End.
news_report
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # event ( Event_ID, Date, Venue, Name, Event_Attendance ) # journalist ( journalist_ID, Name, Nationality, Age, Years_working ) # news_report ( journalist_ID, Event_ID, Work_Type ) # # news_report.Event_ID can be joined with event.Event_ID # news_report.journalist_ID can be joined with journalist.journalist_ID # ### Question: # # Show the nations that have both journalists with more than 10 years of working and journalists with less than 3 years of working. # ### SQL: # # SELECT Nationality FROM journalist WHERE Years_working > 10 INTERSECT SELECT Nationality FROM journalist WHERE Years_working < 3 # ### End.
news_report
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # event ( Event_ID, Date, Venue, Name, Event_Attendance ) # journalist ( journalist_ID, Name, Nationality, Age, Years_working ) # news_report ( journalist_ID, Event_ID, Work_Type ) # # news_report.Event_ID can be joined with event.Event_ID # news_report.journalist_ID can be joined with journalist.journalist_ID # ### Question: # # Show the dates, places, and names of events in descending order of the attendance. # ### SQL: # # SELECT Date , Name , venue FROM event ORDER BY Event_Attendance DESC # ### End.
news_report
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # event ( Event_ID, Date, Venue, Name, Event_Attendance ) # journalist ( journalist_ID, Name, Nationality, Age, Years_working ) # news_report ( journalist_ID, Event_ID, Work_Type ) # # news_report.Event_ID can be joined with event.Event_ID # news_report.journalist_ID can be joined with journalist.journalist_ID # ### Question: # # Show the names of journalists and the dates of the events they reported. # ### SQL: # # SELECT T3.Name , T2.Date FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID # ### End.
news_report
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # event ( Event_ID, Date, Venue, Name, Event_Attendance ) # journalist ( journalist_ID, Name, Nationality, Age, Years_working ) # news_report ( journalist_ID, Event_ID, Work_Type ) # # news_report.Event_ID can be joined with event.Event_ID # news_report.journalist_ID can be joined with journalist.journalist_ID # ### Question: # # Show the names of journalists and the names of the events they reported in ascending order # ### SQL: # # SELECT T3.Name , T2.Name FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID ORDER BY T2.Event_Attendance ASC # ### End.
news_report
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # event ( Event_ID, Date, Venue, Name, Event_Attendance ) # journalist ( journalist_ID, Name, Nationality, Age, Years_working ) # news_report ( journalist_ID, Event_ID, Work_Type ) # # news_report.Event_ID can be joined with event.Event_ID # news_report.journalist_ID can be joined with journalist.journalist_ID # ### Question: # # Show the names of journalists and the number of events they reported. # ### SQL: # # SELECT T3.Name , COUNT(*) FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID GROUP BY T3.Name # ### End.
news_report
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # event ( Event_ID, Date, Venue, Name, Event_Attendance ) # journalist ( journalist_ID, Name, Nationality, Age, Years_working ) # news_report ( journalist_ID, Event_ID, Work_Type ) # # news_report.Event_ID can be joined with event.Event_ID # news_report.journalist_ID can be joined with journalist.journalist_ID # ### Question: # # Show the names of journalists that have reported more than one event. # ### SQL: # # SELECT T3.Name FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID GROUP BY T3.Name HAVING COUNT(*) > 1 # ### End.
news_report
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # event ( Event_ID, Date, Venue, Name, Event_Attendance ) # journalist ( journalist_ID, Name, Nationality, Age, Years_working ) # news_report ( journalist_ID, Event_ID, Work_Type ) # # news_report.Event_ID can be joined with event.Event_ID # news_report.journalist_ID can be joined with journalist.journalist_ID # ### Question: # # List the names of journalists who have not reported any event. # ### SQL: # # SELECT Name FROM journalist WHERE journalist_ID NOT IN (SELECT journalist_ID FROM news_report) # ### End.
news_report
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # event ( Event_ID, Date, Venue, Name, Event_Attendance ) # journalist ( journalist_ID, Name, Nationality, Age, Years_working ) # news_report ( journalist_ID, Event_ID, Work_Type ) # # news_report.Event_ID can be joined with event.Event_ID # news_report.journalist_ID can be joined with journalist.journalist_ID # ### Question: # # what are the average and maximum attendances of all events? # ### SQL: # # SELECT avg(Event_Attendance) , max(Event_Attendance) FROM event # ### End.
news_report
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # event ( Event_ID, Date, Venue, Name, Event_Attendance ) # journalist ( journalist_ID, Name, Nationality, Age, Years_working ) # news_report ( journalist_ID, Event_ID, Work_Type ) # # news_report.Event_ID can be joined with event.Event_ID # news_report.journalist_ID can be joined with journalist.journalist_ID # ### Question: # # Find the average age and experience working length of journalists working on different role type. # ### SQL: # # SELECT avg(t1.age) , avg(Years_working) , t2.work_type FROM journalist AS t1 JOIN news_report AS t2 ON t1.journalist_id = t2.journalist_id GROUP BY t2.work_type # ### End.
news_report
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # event ( Event_ID, Date, Venue, Name, Event_Attendance ) # journalist ( journalist_ID, Name, Nationality, Age, Years_working ) # news_report ( journalist_ID, Event_ID, Work_Type ) # # news_report.Event_ID can be joined with event.Event_ID # news_report.journalist_ID can be joined with journalist.journalist_ID # ### Question: # # List the event venues and names that have the top 2 most number of people attended. # ### SQL: # # SELECT venue , name FROM event ORDER BY Event_Attendance DESC LIMIT 2 # ### End.
restaurant_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Student ( StuID, LName, Fname, Age, Sex, Major, Advisor, city_code ) # Restaurant ( ResID, ResName, Address, Rating ) # Type_Of_Restaurant ( ResID, ResTypeID ) # Restaurant_Type ( ResTypeID, ResTypeName, ResTypeDescription ) # Visits_Restaurant ( StuID, ResID, Time, Spent ) # # Type_Of_Restaurant.ResTypeID can be joined with Restaurant_Type.ResTypeID # Type_Of_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.StuID can be joined with Student.StuID # ### Question: # # Show me all the restaurants. # ### SQL: # # SELECT ResName FROM Restaurant; # ### End.
restaurant_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Student ( StuID, LName, Fname, Age, Sex, Major, Advisor, city_code ) # Restaurant ( ResID, ResName, Address, Rating ) # Type_Of_Restaurant ( ResID, ResTypeID ) # Restaurant_Type ( ResTypeID, ResTypeName, ResTypeDescription ) # Visits_Restaurant ( StuID, ResID, Time, Spent ) # # Type_Of_Restaurant.ResTypeID can be joined with Restaurant_Type.ResTypeID # Type_Of_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.StuID can be joined with Student.StuID # ### Question: # # What is the address of the restaurant Subway? # ### SQL: # # SELECT Address FROM Restaurant WHERE ResName = "Subway"; # ### End.
restaurant_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Student ( StuID, LName, Fname, Age, Sex, Major, Advisor, city_code ) # Restaurant ( ResID, ResName, Address, Rating ) # Type_Of_Restaurant ( ResID, ResTypeID ) # Restaurant_Type ( ResTypeID, ResTypeName, ResTypeDescription ) # Visits_Restaurant ( StuID, ResID, Time, Spent ) # # Type_Of_Restaurant.ResTypeID can be joined with Restaurant_Type.ResTypeID # Type_Of_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.StuID can be joined with Student.StuID # ### Question: # # What is the rating of the restaurant Subway? # ### SQL: # # SELECT Rating FROM Restaurant WHERE ResName = "Subway"; # ### End.
restaurant_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Student ( StuID, LName, Fname, Age, Sex, Major, Advisor, city_code ) # Restaurant ( ResID, ResName, Address, Rating ) # Type_Of_Restaurant ( ResID, ResTypeID ) # Restaurant_Type ( ResTypeID, ResTypeName, ResTypeDescription ) # Visits_Restaurant ( StuID, ResID, Time, Spent ) # # Type_Of_Restaurant.ResTypeID can be joined with Restaurant_Type.ResTypeID # Type_Of_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.StuID can be joined with Student.StuID # ### Question: # # List all restaurant types. # ### SQL: # # SELECT ResTypeName FROM Restaurant_Type; # ### End.
restaurant_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Student ( StuID, LName, Fname, Age, Sex, Major, Advisor, city_code ) # Restaurant ( ResID, ResName, Address, Rating ) # Type_Of_Restaurant ( ResID, ResTypeID ) # Restaurant_Type ( ResTypeID, ResTypeName, ResTypeDescription ) # Visits_Restaurant ( StuID, ResID, Time, Spent ) # # Type_Of_Restaurant.ResTypeID can be joined with Restaurant_Type.ResTypeID # Type_Of_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.StuID can be joined with Student.StuID # ### Question: # # What is the description of the restaurant type Sandwich? # ### SQL: # # SELECT ResTypeDescription FROM Restaurant_Type WHERE ResTypeName = "Sandwich"; # ### End.
restaurant_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Student ( StuID, LName, Fname, Age, Sex, Major, Advisor, city_code ) # Restaurant ( ResID, ResName, Address, Rating ) # Type_Of_Restaurant ( ResID, ResTypeID ) # Restaurant_Type ( ResTypeID, ResTypeName, ResTypeDescription ) # Visits_Restaurant ( StuID, ResID, Time, Spent ) # # Type_Of_Restaurant.ResTypeID can be joined with Restaurant_Type.ResTypeID # Type_Of_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.StuID can be joined with Student.StuID # ### Question: # # Which restaurants have highest rating? List the restaurant name and its rating. # ### SQL: # # SELECT ResName , Rating FROM Restaurant ORDER BY Rating DESC LIMIT 1; # ### End.
restaurant_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Student ( StuID, LName, Fname, Age, Sex, Major, Advisor, city_code ) # Restaurant ( ResID, ResName, Address, Rating ) # Type_Of_Restaurant ( ResID, ResTypeID ) # Restaurant_Type ( ResTypeID, ResTypeName, ResTypeDescription ) # Visits_Restaurant ( StuID, ResID, Time, Spent ) # # Type_Of_Restaurant.ResTypeID can be joined with Restaurant_Type.ResTypeID # Type_Of_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.StuID can be joined with Student.StuID # ### Question: # # What is the age of student Linda Smith? # ### SQL: # # SELECT Age FROM Student WHERE Fname = "Linda" AND Lname = "Smith"; # ### End.
restaurant_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Student ( StuID, LName, Fname, Age, Sex, Major, Advisor, city_code ) # Restaurant ( ResID, ResName, Address, Rating ) # Type_Of_Restaurant ( ResID, ResTypeID ) # Restaurant_Type ( ResTypeID, ResTypeName, ResTypeDescription ) # Visits_Restaurant ( StuID, ResID, Time, Spent ) # # Type_Of_Restaurant.ResTypeID can be joined with Restaurant_Type.ResTypeID # Type_Of_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.StuID can be joined with Student.StuID # ### Question: # # What is the gender of the student Linda Smith? # ### SQL: # # SELECT Sex FROM Student WHERE Fname = "Linda" AND Lname = "Smith"; # ### End.
restaurant_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Student ( StuID, LName, Fname, Age, Sex, Major, Advisor, city_code ) # Restaurant ( ResID, ResName, Address, Rating ) # Type_Of_Restaurant ( ResID, ResTypeID ) # Restaurant_Type ( ResTypeID, ResTypeName, ResTypeDescription ) # Visits_Restaurant ( StuID, ResID, Time, Spent ) # # Type_Of_Restaurant.ResTypeID can be joined with Restaurant_Type.ResTypeID # Type_Of_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.StuID can be joined with Student.StuID # ### Question: # # List all students' first names and last names who majored in 600. # ### SQL: # # SELECT Fname , Lname FROM Student WHERE Major = 600; # ### End.
restaurant_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Student ( StuID, LName, Fname, Age, Sex, Major, Advisor, city_code ) # Restaurant ( ResID, ResName, Address, Rating ) # Type_Of_Restaurant ( ResID, ResTypeID ) # Restaurant_Type ( ResTypeID, ResTypeName, ResTypeDescription ) # Visits_Restaurant ( StuID, ResID, Time, Spent ) # # Type_Of_Restaurant.ResTypeID can be joined with Restaurant_Type.ResTypeID # Type_Of_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.StuID can be joined with Student.StuID # ### Question: # # Which city does student Linda Smith live in? # ### SQL: # # SELECT city_code FROM Student WHERE Fname = "Linda" AND Lname = "Smith"; # ### End.
restaurant_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Student ( StuID, LName, Fname, Age, Sex, Major, Advisor, city_code ) # Restaurant ( ResID, ResName, Address, Rating ) # Type_Of_Restaurant ( ResID, ResTypeID ) # Restaurant_Type ( ResTypeID, ResTypeName, ResTypeDescription ) # Visits_Restaurant ( StuID, ResID, Time, Spent ) # # Type_Of_Restaurant.ResTypeID can be joined with Restaurant_Type.ResTypeID # Type_Of_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.StuID can be joined with Student.StuID # ### Question: # # Advisor 1121 has how many students? # ### SQL: # # SELECT count(*) FROM Student WHERE Advisor = 1121; # ### End.
restaurant_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Student ( StuID, LName, Fname, Age, Sex, Major, Advisor, city_code ) # Restaurant ( ResID, ResName, Address, Rating ) # Type_Of_Restaurant ( ResID, ResTypeID ) # Restaurant_Type ( ResTypeID, ResTypeName, ResTypeDescription ) # Visits_Restaurant ( StuID, ResID, Time, Spent ) # # Type_Of_Restaurant.ResTypeID can be joined with Restaurant_Type.ResTypeID # Type_Of_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.StuID can be joined with Student.StuID # ### Question: # # Which Advisor has most of students? List advisor and the number of students. # ### SQL: # # SELECT Advisor , count(*) FROM Student GROUP BY Advisor ORDER BY count(Advisor) DESC LIMIT 1; # ### End.
restaurant_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Student ( StuID, LName, Fname, Age, Sex, Major, Advisor, city_code ) # Restaurant ( ResID, ResName, Address, Rating ) # Type_Of_Restaurant ( ResID, ResTypeID ) # Restaurant_Type ( ResTypeID, ResTypeName, ResTypeDescription ) # Visits_Restaurant ( StuID, ResID, Time, Spent ) # # Type_Of_Restaurant.ResTypeID can be joined with Restaurant_Type.ResTypeID # Type_Of_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.StuID can be joined with Student.StuID # ### Question: # # Which major has least number of students? List the major and the number of students. # ### SQL: # # SELECT Major , count(*) FROM Student GROUP BY Major ORDER BY count(Major) ASC LIMIT 1; # ### End.
restaurant_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Student ( StuID, LName, Fname, Age, Sex, Major, Advisor, city_code ) # Restaurant ( ResID, ResName, Address, Rating ) # Type_Of_Restaurant ( ResID, ResTypeID ) # Restaurant_Type ( ResTypeID, ResTypeName, ResTypeDescription ) # Visits_Restaurant ( StuID, ResID, Time, Spent ) # # Type_Of_Restaurant.ResTypeID can be joined with Restaurant_Type.ResTypeID # Type_Of_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.StuID can be joined with Student.StuID # ### Question: # # Which major has between 2 and 30 number of students? List major and the number of students. # ### SQL: # # SELECT Major , count(*) FROM Student GROUP BY Major HAVING count(Major) BETWEEN 2 AND 30; # ### End.
restaurant_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Student ( StuID, LName, Fname, Age, Sex, Major, Advisor, city_code ) # Restaurant ( ResID, ResName, Address, Rating ) # Type_Of_Restaurant ( ResID, ResTypeID ) # Restaurant_Type ( ResTypeID, ResTypeName, ResTypeDescription ) # Visits_Restaurant ( StuID, ResID, Time, Spent ) # # Type_Of_Restaurant.ResTypeID can be joined with Restaurant_Type.ResTypeID # Type_Of_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.StuID can be joined with Student.StuID # ### Question: # # Which student's age is older than 18 and is majoring in 600? List each student's first and last name. # ### SQL: # # SELECT Fname , Lname FROM Student WHERE Age > 18 AND Major = 600; # ### End.
restaurant_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Student ( StuID, LName, Fname, Age, Sex, Major, Advisor, city_code ) # Restaurant ( ResID, ResName, Address, Rating ) # Type_Of_Restaurant ( ResID, ResTypeID ) # Restaurant_Type ( ResTypeID, ResTypeName, ResTypeDescription ) # Visits_Restaurant ( StuID, ResID, Time, Spent ) # # Type_Of_Restaurant.ResTypeID can be joined with Restaurant_Type.ResTypeID # Type_Of_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.StuID can be joined with Student.StuID # ### Question: # # List all female students age is older than 18 who is not majoring in 600. List students' first name and last name. # ### SQL: # # SELECT Fname , Lname FROM Student WHERE Age > 18 AND Major != 600 AND Sex = 'F'; # ### End.
restaurant_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Student ( StuID, LName, Fname, Age, Sex, Major, Advisor, city_code ) # Restaurant ( ResID, ResName, Address, Rating ) # Type_Of_Restaurant ( ResID, ResTypeID ) # Restaurant_Type ( ResTypeID, ResTypeName, ResTypeDescription ) # Visits_Restaurant ( StuID, ResID, Time, Spent ) # # Type_Of_Restaurant.ResTypeID can be joined with Restaurant_Type.ResTypeID # Type_Of_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.StuID can be joined with Student.StuID # ### Question: # # How many restaurant is the Sandwich type restaurant? # ### SQL: # # SELECT count(*) FROM Restaurant JOIN Type_Of_Restaurant ON Restaurant.ResID = Type_Of_Restaurant.ResID JOIN Restaurant_Type ON Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID GROUP BY Type_Of_Restaurant.ResTypeID HAVING Restaurant_Type.ResTypeName = 'Sandwich' # ### End.
restaurant_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Student ( StuID, LName, Fname, Age, Sex, Major, Advisor, city_code ) # Restaurant ( ResID, ResName, Address, Rating ) # Type_Of_Restaurant ( ResID, ResTypeID ) # Restaurant_Type ( ResTypeID, ResTypeName, ResTypeDescription ) # Visits_Restaurant ( StuID, ResID, Time, Spent ) # # Type_Of_Restaurant.ResTypeID can be joined with Restaurant_Type.ResTypeID # Type_Of_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.StuID can be joined with Student.StuID # ### Question: # # How long does student Linda Smith spend on the restaurant in total? # ### SQL: # # SELECT sum(Spent) FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID WHERE Student.Fname = "Linda" AND Student.Lname = "Smith"; # ### End.
restaurant_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Student ( StuID, LName, Fname, Age, Sex, Major, Advisor, city_code ) # Restaurant ( ResID, ResName, Address, Rating ) # Type_Of_Restaurant ( ResID, ResTypeID ) # Restaurant_Type ( ResTypeID, ResTypeName, ResTypeDescription ) # Visits_Restaurant ( StuID, ResID, Time, Spent ) # # Type_Of_Restaurant.ResTypeID can be joined with Restaurant_Type.ResTypeID # Type_Of_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.StuID can be joined with Student.StuID # ### Question: # # How many times has the student Linda Smith visited Subway? # ### SQL: # # SELECT count(*) FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID WHERE Student.Fname = "Linda" AND Student.Lname = "Smith" AND Restaurant.ResName = "Subway"; # ### End.
restaurant_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Student ( StuID, LName, Fname, Age, Sex, Major, Advisor, city_code ) # Restaurant ( ResID, ResName, Address, Rating ) # Type_Of_Restaurant ( ResID, ResTypeID ) # Restaurant_Type ( ResTypeID, ResTypeName, ResTypeDescription ) # Visits_Restaurant ( StuID, ResID, Time, Spent ) # # Type_Of_Restaurant.ResTypeID can be joined with Restaurant_Type.ResTypeID # Type_Of_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.StuID can be joined with Student.StuID # ### Question: # # When did Linda Smith visit Subway? # ### SQL: # # SELECT TIME FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID WHERE Student.Fname = "Linda" AND Student.Lname = "Smith" AND Restaurant.ResName = "Subway"; # ### End.
restaurant_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Student ( StuID, LName, Fname, Age, Sex, Major, Advisor, city_code ) # Restaurant ( ResID, ResName, Address, Rating ) # Type_Of_Restaurant ( ResID, ResTypeID ) # Restaurant_Type ( ResTypeID, ResTypeName, ResTypeDescription ) # Visits_Restaurant ( StuID, ResID, Time, Spent ) # # Type_Of_Restaurant.ResTypeID can be joined with Restaurant_Type.ResTypeID # Type_Of_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.StuID can be joined with Student.StuID # ### Question: # # At which restaurant did the students spend the least amount of time? List restaurant and the time students spent on in total. # ### SQL: # # SELECT Restaurant.ResName , sum(Visits_Restaurant.Spent) FROM Visits_Restaurant JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID GROUP BY Restaurant.ResID ORDER BY sum(Visits_Restaurant.Spent) ASC LIMIT 1; # ### End.
restaurant_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Student ( StuID, LName, Fname, Age, Sex, Major, Advisor, city_code ) # Restaurant ( ResID, ResName, Address, Rating ) # Type_Of_Restaurant ( ResID, ResTypeID ) # Restaurant_Type ( ResTypeID, ResTypeName, ResTypeDescription ) # Visits_Restaurant ( StuID, ResID, Time, Spent ) # # Type_Of_Restaurant.ResTypeID can be joined with Restaurant_Type.ResTypeID # Type_Of_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.ResID can be joined with Restaurant.ResID # Visits_Restaurant.StuID can be joined with Student.StuID # ### Question: # # Which student visited restaurant most often? List student's first name and last name. # ### SQL: # # SELECT Student.Fname , Student.Lname FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID GROUP BY Student.StuID ORDER BY count(*) DESC LIMIT 1; # ### End.
customer_deliveries
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Products ( product_id, product_name, product_price, product_description ) # Addresses ( address_id, address_details, city, zip_postcode, state_province_county, country ) # Customers ( customer_id, payment_method, customer_name, customer_phone, customer_email, date_became_customer ) # Regular_Orders ( regular_order_id, distributer_id ) # Regular_Order_Products ( regular_order_id, product_id ) # Actual_Orders ( actual_order_id, order_status_code, regular_order_id, actual_order_date ) # Actual_Order_Products ( actual_order_id, product_id ) # Customer_Addresses ( customer_id, address_id, date_from, address_type, date_to ) # Delivery_Routes ( route_id, route_name, other_route_details ) # Delivery_Route_Locations ( location_code, route_id, location_address_id, location_name ) # Trucks ( truck_id, truck_licence_number, truck_details ) # Employees ( employee_id, employee_address_id, employee_name, employee_phone ) # Order_Deliveries ( location_code, actual_order_id, delivery_status_code, driver_employee_id, truck_id, delivery_date ) # # Regular_Orders.distributer_id can be joined with Customers.customer_id # Regular_Order_Products.regular_order_id can be joined with Regular_Orders.regular_order_id # Regular_Order_Products.product_id can be joined with Products.product_id # Actual_Orders.regular_order_id can be joined with Regular_Orders.regular_order_id # Actual_Order_Products.actual_order_id can be joined with Actual_Orders.actual_order_id # Actual_Order_Products.product_id can be joined with Products.product_id # Customer_Addresses.address_id can be joined with Addresses.address_id # Customer_Addresses.customer_id can be joined with Customers.customer_id # Delivery_Route_Locations.route_id can be joined with Delivery_Routes.route_id # Delivery_Route_Locations.location_address_id can be joined with Addresses.address_id # Employees.employee_address_id can be joined with Addresses.address_id # Order_Deliveries.driver_employee_id can be joined with Employees.employee_id # Order_Deliveries.location_code can be joined with Delivery_Route_Locations.location_code # Order_Deliveries.actual_order_id can be joined with Actual_Orders.actual_order_id # Order_Deliveries.truck_id can be joined with Trucks.truck_id # ### Question: # # Find the ids of orders whose status is 'Success'. # ### SQL: # # SELECT actual_order_id FROM actual_orders WHERE order_status_code = 'Success' # ### End.
customer_deliveries
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Products ( product_id, product_name, product_price, product_description ) # Addresses ( address_id, address_details, city, zip_postcode, state_province_county, country ) # Customers ( customer_id, payment_method, customer_name, customer_phone, customer_email, date_became_customer ) # Regular_Orders ( regular_order_id, distributer_id ) # Regular_Order_Products ( regular_order_id, product_id ) # Actual_Orders ( actual_order_id, order_status_code, regular_order_id, actual_order_date ) # Actual_Order_Products ( actual_order_id, product_id ) # Customer_Addresses ( customer_id, address_id, date_from, address_type, date_to ) # Delivery_Routes ( route_id, route_name, other_route_details ) # Delivery_Route_Locations ( location_code, route_id, location_address_id, location_name ) # Trucks ( truck_id, truck_licence_number, truck_details ) # Employees ( employee_id, employee_address_id, employee_name, employee_phone ) # Order_Deliveries ( location_code, actual_order_id, delivery_status_code, driver_employee_id, truck_id, delivery_date ) # # Regular_Orders.distributer_id can be joined with Customers.customer_id # Regular_Order_Products.regular_order_id can be joined with Regular_Orders.regular_order_id # Regular_Order_Products.product_id can be joined with Products.product_id # Actual_Orders.regular_order_id can be joined with Regular_Orders.regular_order_id # Actual_Order_Products.actual_order_id can be joined with Actual_Orders.actual_order_id # Actual_Order_Products.product_id can be joined with Products.product_id # Customer_Addresses.address_id can be joined with Addresses.address_id # Customer_Addresses.customer_id can be joined with Customers.customer_id # Delivery_Route_Locations.route_id can be joined with Delivery_Routes.route_id # Delivery_Route_Locations.location_address_id can be joined with Addresses.address_id # Employees.employee_address_id can be joined with Addresses.address_id # Order_Deliveries.driver_employee_id can be joined with Employees.employee_id # Order_Deliveries.location_code can be joined with Delivery_Route_Locations.location_code # Order_Deliveries.actual_order_id can be joined with Actual_Orders.actual_order_id # Order_Deliveries.truck_id can be joined with Trucks.truck_id # ### Question: # # Find the name and price of the product that has been ordered the greatest number of times. # ### SQL: # # SELECT t1.product_name , t1.product_price FROM products AS t1 JOIN regular_order_products AS t2 ON t1.product_id = t2.product_id GROUP BY t2.product_id ORDER BY count(*) DESC LIMIT 1 # ### End.
customer_deliveries
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Products ( product_id, product_name, product_price, product_description ) # Addresses ( address_id, address_details, city, zip_postcode, state_province_county, country ) # Customers ( customer_id, payment_method, customer_name, customer_phone, customer_email, date_became_customer ) # Regular_Orders ( regular_order_id, distributer_id ) # Regular_Order_Products ( regular_order_id, product_id ) # Actual_Orders ( actual_order_id, order_status_code, regular_order_id, actual_order_date ) # Actual_Order_Products ( actual_order_id, product_id ) # Customer_Addresses ( customer_id, address_id, date_from, address_type, date_to ) # Delivery_Routes ( route_id, route_name, other_route_details ) # Delivery_Route_Locations ( location_code, route_id, location_address_id, location_name ) # Trucks ( truck_id, truck_licence_number, truck_details ) # Employees ( employee_id, employee_address_id, employee_name, employee_phone ) # Order_Deliveries ( location_code, actual_order_id, delivery_status_code, driver_employee_id, truck_id, delivery_date ) # # Regular_Orders.distributer_id can be joined with Customers.customer_id # Regular_Order_Products.regular_order_id can be joined with Regular_Orders.regular_order_id # Regular_Order_Products.product_id can be joined with Products.product_id # Actual_Orders.regular_order_id can be joined with Regular_Orders.regular_order_id # Actual_Order_Products.actual_order_id can be joined with Actual_Orders.actual_order_id # Actual_Order_Products.product_id can be joined with Products.product_id # Customer_Addresses.address_id can be joined with Addresses.address_id # Customer_Addresses.customer_id can be joined with Customers.customer_id # Delivery_Route_Locations.route_id can be joined with Delivery_Routes.route_id # Delivery_Route_Locations.location_address_id can be joined with Addresses.address_id # Employees.employee_address_id can be joined with Addresses.address_id # Order_Deliveries.driver_employee_id can be joined with Employees.employee_id # Order_Deliveries.location_code can be joined with Delivery_Route_Locations.location_code # Order_Deliveries.actual_order_id can be joined with Actual_Orders.actual_order_id # Order_Deliveries.truck_id can be joined with Trucks.truck_id # ### Question: # # Find the number of customers in total. # ### SQL: # # SELECT count(*) FROM customers # ### End.
customer_deliveries
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Products ( product_id, product_name, product_price, product_description ) # Addresses ( address_id, address_details, city, zip_postcode, state_province_county, country ) # Customers ( customer_id, payment_method, customer_name, customer_phone, customer_email, date_became_customer ) # Regular_Orders ( regular_order_id, distributer_id ) # Regular_Order_Products ( regular_order_id, product_id ) # Actual_Orders ( actual_order_id, order_status_code, regular_order_id, actual_order_date ) # Actual_Order_Products ( actual_order_id, product_id ) # Customer_Addresses ( customer_id, address_id, date_from, address_type, date_to ) # Delivery_Routes ( route_id, route_name, other_route_details ) # Delivery_Route_Locations ( location_code, route_id, location_address_id, location_name ) # Trucks ( truck_id, truck_licence_number, truck_details ) # Employees ( employee_id, employee_address_id, employee_name, employee_phone ) # Order_Deliveries ( location_code, actual_order_id, delivery_status_code, driver_employee_id, truck_id, delivery_date ) # # Regular_Orders.distributer_id can be joined with Customers.customer_id # Regular_Order_Products.regular_order_id can be joined with Regular_Orders.regular_order_id # Regular_Order_Products.product_id can be joined with Products.product_id # Actual_Orders.regular_order_id can be joined with Regular_Orders.regular_order_id # Actual_Order_Products.actual_order_id can be joined with Actual_Orders.actual_order_id # Actual_Order_Products.product_id can be joined with Products.product_id # Customer_Addresses.address_id can be joined with Addresses.address_id # Customer_Addresses.customer_id can be joined with Customers.customer_id # Delivery_Route_Locations.route_id can be joined with Delivery_Routes.route_id # Delivery_Route_Locations.location_address_id can be joined with Addresses.address_id # Employees.employee_address_id can be joined with Addresses.address_id # Order_Deliveries.driver_employee_id can be joined with Employees.employee_id # Order_Deliveries.location_code can be joined with Delivery_Route_Locations.location_code # Order_Deliveries.actual_order_id can be joined with Actual_Orders.actual_order_id # Order_Deliveries.truck_id can be joined with Trucks.truck_id # ### Question: # # How many different payment methods are there? # ### SQL: # # SELECT count(DISTINCT payment_method) FROM customers # ### End.
customer_deliveries
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Products ( product_id, product_name, product_price, product_description ) # Addresses ( address_id, address_details, city, zip_postcode, state_province_county, country ) # Customers ( customer_id, payment_method, customer_name, customer_phone, customer_email, date_became_customer ) # Regular_Orders ( regular_order_id, distributer_id ) # Regular_Order_Products ( regular_order_id, product_id ) # Actual_Orders ( actual_order_id, order_status_code, regular_order_id, actual_order_date ) # Actual_Order_Products ( actual_order_id, product_id ) # Customer_Addresses ( customer_id, address_id, date_from, address_type, date_to ) # Delivery_Routes ( route_id, route_name, other_route_details ) # Delivery_Route_Locations ( location_code, route_id, location_address_id, location_name ) # Trucks ( truck_id, truck_licence_number, truck_details ) # Employees ( employee_id, employee_address_id, employee_name, employee_phone ) # Order_Deliveries ( location_code, actual_order_id, delivery_status_code, driver_employee_id, truck_id, delivery_date ) # # Regular_Orders.distributer_id can be joined with Customers.customer_id # Regular_Order_Products.regular_order_id can be joined with Regular_Orders.regular_order_id # Regular_Order_Products.product_id can be joined with Products.product_id # Actual_Orders.regular_order_id can be joined with Regular_Orders.regular_order_id # Actual_Order_Products.actual_order_id can be joined with Actual_Orders.actual_order_id # Actual_Order_Products.product_id can be joined with Products.product_id # Customer_Addresses.address_id can be joined with Addresses.address_id # Customer_Addresses.customer_id can be joined with Customers.customer_id # Delivery_Route_Locations.route_id can be joined with Delivery_Routes.route_id # Delivery_Route_Locations.location_address_id can be joined with Addresses.address_id # Employees.employee_address_id can be joined with Addresses.address_id # Order_Deliveries.driver_employee_id can be joined with Employees.employee_id # Order_Deliveries.location_code can be joined with Delivery_Route_Locations.location_code # Order_Deliveries.actual_order_id can be joined with Actual_Orders.actual_order_id # Order_Deliveries.truck_id can be joined with Trucks.truck_id # ### Question: # # Show the details of all trucks in the order of their license number. # ### SQL: # # SELECT truck_details FROM trucks ORDER BY truck_licence_number # ### End.
customer_deliveries
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Products ( product_id, product_name, product_price, product_description ) # Addresses ( address_id, address_details, city, zip_postcode, state_province_county, country ) # Customers ( customer_id, payment_method, customer_name, customer_phone, customer_email, date_became_customer ) # Regular_Orders ( regular_order_id, distributer_id ) # Regular_Order_Products ( regular_order_id, product_id ) # Actual_Orders ( actual_order_id, order_status_code, regular_order_id, actual_order_date ) # Actual_Order_Products ( actual_order_id, product_id ) # Customer_Addresses ( customer_id, address_id, date_from, address_type, date_to ) # Delivery_Routes ( route_id, route_name, other_route_details ) # Delivery_Route_Locations ( location_code, route_id, location_address_id, location_name ) # Trucks ( truck_id, truck_licence_number, truck_details ) # Employees ( employee_id, employee_address_id, employee_name, employee_phone ) # Order_Deliveries ( location_code, actual_order_id, delivery_status_code, driver_employee_id, truck_id, delivery_date ) # # Regular_Orders.distributer_id can be joined with Customers.customer_id # Regular_Order_Products.regular_order_id can be joined with Regular_Orders.regular_order_id # Regular_Order_Products.product_id can be joined with Products.product_id # Actual_Orders.regular_order_id can be joined with Regular_Orders.regular_order_id # Actual_Order_Products.actual_order_id can be joined with Actual_Orders.actual_order_id # Actual_Order_Products.product_id can be joined with Products.product_id # Customer_Addresses.address_id can be joined with Addresses.address_id # Customer_Addresses.customer_id can be joined with Customers.customer_id # Delivery_Route_Locations.route_id can be joined with Delivery_Routes.route_id # Delivery_Route_Locations.location_address_id can be joined with Addresses.address_id # Employees.employee_address_id can be joined with Addresses.address_id # Order_Deliveries.driver_employee_id can be joined with Employees.employee_id # Order_Deliveries.location_code can be joined with Delivery_Route_Locations.location_code # Order_Deliveries.actual_order_id can be joined with Actual_Orders.actual_order_id # Order_Deliveries.truck_id can be joined with Trucks.truck_id # ### Question: # # Find the name of the most expensive product. # ### SQL: # # SELECT product_name FROM products ORDER BY product_price DESC LIMIT 1 # ### End.
customer_deliveries
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Products ( product_id, product_name, product_price, product_description ) # Addresses ( address_id, address_details, city, zip_postcode, state_province_county, country ) # Customers ( customer_id, payment_method, customer_name, customer_phone, customer_email, date_became_customer ) # Regular_Orders ( regular_order_id, distributer_id ) # Regular_Order_Products ( regular_order_id, product_id ) # Actual_Orders ( actual_order_id, order_status_code, regular_order_id, actual_order_date ) # Actual_Order_Products ( actual_order_id, product_id ) # Customer_Addresses ( customer_id, address_id, date_from, address_type, date_to ) # Delivery_Routes ( route_id, route_name, other_route_details ) # Delivery_Route_Locations ( location_code, route_id, location_address_id, location_name ) # Trucks ( truck_id, truck_licence_number, truck_details ) # Employees ( employee_id, employee_address_id, employee_name, employee_phone ) # Order_Deliveries ( location_code, actual_order_id, delivery_status_code, driver_employee_id, truck_id, delivery_date ) # # Regular_Orders.distributer_id can be joined with Customers.customer_id # Regular_Order_Products.regular_order_id can be joined with Regular_Orders.regular_order_id # Regular_Order_Products.product_id can be joined with Products.product_id # Actual_Orders.regular_order_id can be joined with Regular_Orders.regular_order_id # Actual_Order_Products.actual_order_id can be joined with Actual_Orders.actual_order_id # Actual_Order_Products.product_id can be joined with Products.product_id # Customer_Addresses.address_id can be joined with Addresses.address_id # Customer_Addresses.customer_id can be joined with Customers.customer_id # Delivery_Route_Locations.route_id can be joined with Delivery_Routes.route_id # Delivery_Route_Locations.location_address_id can be joined with Addresses.address_id # Employees.employee_address_id can be joined with Addresses.address_id # Order_Deliveries.driver_employee_id can be joined with Employees.employee_id # Order_Deliveries.location_code can be joined with Delivery_Route_Locations.location_code # Order_Deliveries.actual_order_id can be joined with Actual_Orders.actual_order_id # Order_Deliveries.truck_id can be joined with Trucks.truck_id # ### Question: # # Find the names of customers who are not living in the state of California. # ### SQL: # # SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.state_province_county = 'California' # ### End.
customer_deliveries
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Products ( product_id, product_name, product_price, product_description ) # Addresses ( address_id, address_details, city, zip_postcode, state_province_county, country ) # Customers ( customer_id, payment_method, customer_name, customer_phone, customer_email, date_became_customer ) # Regular_Orders ( regular_order_id, distributer_id ) # Regular_Order_Products ( regular_order_id, product_id ) # Actual_Orders ( actual_order_id, order_status_code, regular_order_id, actual_order_date ) # Actual_Order_Products ( actual_order_id, product_id ) # Customer_Addresses ( customer_id, address_id, date_from, address_type, date_to ) # Delivery_Routes ( route_id, route_name, other_route_details ) # Delivery_Route_Locations ( location_code, route_id, location_address_id, location_name ) # Trucks ( truck_id, truck_licence_number, truck_details ) # Employees ( employee_id, employee_address_id, employee_name, employee_phone ) # Order_Deliveries ( location_code, actual_order_id, delivery_status_code, driver_employee_id, truck_id, delivery_date ) # # Regular_Orders.distributer_id can be joined with Customers.customer_id # Regular_Order_Products.regular_order_id can be joined with Regular_Orders.regular_order_id # Regular_Order_Products.product_id can be joined with Products.product_id # Actual_Orders.regular_order_id can be joined with Regular_Orders.regular_order_id # Actual_Order_Products.actual_order_id can be joined with Actual_Orders.actual_order_id # Actual_Order_Products.product_id can be joined with Products.product_id # Customer_Addresses.address_id can be joined with Addresses.address_id # Customer_Addresses.customer_id can be joined with Customers.customer_id # Delivery_Route_Locations.route_id can be joined with Delivery_Routes.route_id # Delivery_Route_Locations.location_address_id can be joined with Addresses.address_id # Employees.employee_address_id can be joined with Addresses.address_id # Order_Deliveries.driver_employee_id can be joined with Employees.employee_id # Order_Deliveries.location_code can be joined with Delivery_Route_Locations.location_code # Order_Deliveries.actual_order_id can be joined with Actual_Orders.actual_order_id # Order_Deliveries.truck_id can be joined with Trucks.truck_id # ### Question: # # List the names and emails of customers who payed by Visa card. # ### SQL: # # SELECT customer_email , customer_name FROM customers WHERE payment_method = 'Visa' # ### End.
customer_deliveries
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Products ( product_id, product_name, product_price, product_description ) # Addresses ( address_id, address_details, city, zip_postcode, state_province_county, country ) # Customers ( customer_id, payment_method, customer_name, customer_phone, customer_email, date_became_customer ) # Regular_Orders ( regular_order_id, distributer_id ) # Regular_Order_Products ( regular_order_id, product_id ) # Actual_Orders ( actual_order_id, order_status_code, regular_order_id, actual_order_date ) # Actual_Order_Products ( actual_order_id, product_id ) # Customer_Addresses ( customer_id, address_id, date_from, address_type, date_to ) # Delivery_Routes ( route_id, route_name, other_route_details ) # Delivery_Route_Locations ( location_code, route_id, location_address_id, location_name ) # Trucks ( truck_id, truck_licence_number, truck_details ) # Employees ( employee_id, employee_address_id, employee_name, employee_phone ) # Order_Deliveries ( location_code, actual_order_id, delivery_status_code, driver_employee_id, truck_id, delivery_date ) # # Regular_Orders.distributer_id can be joined with Customers.customer_id # Regular_Order_Products.regular_order_id can be joined with Regular_Orders.regular_order_id # Regular_Order_Products.product_id can be joined with Products.product_id # Actual_Orders.regular_order_id can be joined with Regular_Orders.regular_order_id # Actual_Order_Products.actual_order_id can be joined with Actual_Orders.actual_order_id # Actual_Order_Products.product_id can be joined with Products.product_id # Customer_Addresses.address_id can be joined with Addresses.address_id # Customer_Addresses.customer_id can be joined with Customers.customer_id # Delivery_Route_Locations.route_id can be joined with Delivery_Routes.route_id # Delivery_Route_Locations.location_address_id can be joined with Addresses.address_id # Employees.employee_address_id can be joined with Addresses.address_id # Order_Deliveries.driver_employee_id can be joined with Employees.employee_id # Order_Deliveries.location_code can be joined with Delivery_Route_Locations.location_code # Order_Deliveries.actual_order_id can be joined with Actual_Orders.actual_order_id # Order_Deliveries.truck_id can be joined with Trucks.truck_id # ### Question: # # Find the names and phone numbers of customers living in California state. # ### SQL: # # SELECT t1.customer_name , t1.customer_phone FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.state_province_county = 'California' # ### End.
customer_deliveries
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Products ( product_id, product_name, product_price, product_description ) # Addresses ( address_id, address_details, city, zip_postcode, state_province_county, country ) # Customers ( customer_id, payment_method, customer_name, customer_phone, customer_email, date_became_customer ) # Regular_Orders ( regular_order_id, distributer_id ) # Regular_Order_Products ( regular_order_id, product_id ) # Actual_Orders ( actual_order_id, order_status_code, regular_order_id, actual_order_date ) # Actual_Order_Products ( actual_order_id, product_id ) # Customer_Addresses ( customer_id, address_id, date_from, address_type, date_to ) # Delivery_Routes ( route_id, route_name, other_route_details ) # Delivery_Route_Locations ( location_code, route_id, location_address_id, location_name ) # Trucks ( truck_id, truck_licence_number, truck_details ) # Employees ( employee_id, employee_address_id, employee_name, employee_phone ) # Order_Deliveries ( location_code, actual_order_id, delivery_status_code, driver_employee_id, truck_id, delivery_date ) # # Regular_Orders.distributer_id can be joined with Customers.customer_id # Regular_Order_Products.regular_order_id can be joined with Regular_Orders.regular_order_id # Regular_Order_Products.product_id can be joined with Products.product_id # Actual_Orders.regular_order_id can be joined with Regular_Orders.regular_order_id # Actual_Order_Products.actual_order_id can be joined with Actual_Orders.actual_order_id # Actual_Order_Products.product_id can be joined with Products.product_id # Customer_Addresses.address_id can be joined with Addresses.address_id # Customer_Addresses.customer_id can be joined with Customers.customer_id # Delivery_Route_Locations.route_id can be joined with Delivery_Routes.route_id # Delivery_Route_Locations.location_address_id can be joined with Addresses.address_id # Employees.employee_address_id can be joined with Addresses.address_id # Order_Deliveries.driver_employee_id can be joined with Employees.employee_id # Order_Deliveries.location_code can be joined with Delivery_Route_Locations.location_code # Order_Deliveries.actual_order_id can be joined with Actual_Orders.actual_order_id # Order_Deliveries.truck_id can be joined with Trucks.truck_id # ### Question: # # Find the states which do not have any employee in their record. # ### SQL: # # SELECT state_province_county FROM addresses WHERE address_id NOT IN (SELECT employee_address_id FROM Employees) # ### End.
customer_deliveries
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Products ( product_id, product_name, product_price, product_description ) # Addresses ( address_id, address_details, city, zip_postcode, state_province_county, country ) # Customers ( customer_id, payment_method, customer_name, customer_phone, customer_email, date_became_customer ) # Regular_Orders ( regular_order_id, distributer_id ) # Regular_Order_Products ( regular_order_id, product_id ) # Actual_Orders ( actual_order_id, order_status_code, regular_order_id, actual_order_date ) # Actual_Order_Products ( actual_order_id, product_id ) # Customer_Addresses ( customer_id, address_id, date_from, address_type, date_to ) # Delivery_Routes ( route_id, route_name, other_route_details ) # Delivery_Route_Locations ( location_code, route_id, location_address_id, location_name ) # Trucks ( truck_id, truck_licence_number, truck_details ) # Employees ( employee_id, employee_address_id, employee_name, employee_phone ) # Order_Deliveries ( location_code, actual_order_id, delivery_status_code, driver_employee_id, truck_id, delivery_date ) # # Regular_Orders.distributer_id can be joined with Customers.customer_id # Regular_Order_Products.regular_order_id can be joined with Regular_Orders.regular_order_id # Regular_Order_Products.product_id can be joined with Products.product_id # Actual_Orders.regular_order_id can be joined with Regular_Orders.regular_order_id # Actual_Order_Products.actual_order_id can be joined with Actual_Orders.actual_order_id # Actual_Order_Products.product_id can be joined with Products.product_id # Customer_Addresses.address_id can be joined with Addresses.address_id # Customer_Addresses.customer_id can be joined with Customers.customer_id # Delivery_Route_Locations.route_id can be joined with Delivery_Routes.route_id # Delivery_Route_Locations.location_address_id can be joined with Addresses.address_id # Employees.employee_address_id can be joined with Addresses.address_id # Order_Deliveries.driver_employee_id can be joined with Employees.employee_id # Order_Deliveries.location_code can be joined with Delivery_Route_Locations.location_code # Order_Deliveries.actual_order_id can be joined with Actual_Orders.actual_order_id # Order_Deliveries.truck_id can be joined with Trucks.truck_id # ### Question: # # List the names, phone numbers, and emails of all customers sorted by their dates of becoming customers. # ### SQL: # # SELECT customer_name , customer_phone , customer_email FROM Customers ORDER BY date_became_customer # ### End.
customer_deliveries
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Products ( product_id, product_name, product_price, product_description ) # Addresses ( address_id, address_details, city, zip_postcode, state_province_county, country ) # Customers ( customer_id, payment_method, customer_name, customer_phone, customer_email, date_became_customer ) # Regular_Orders ( regular_order_id, distributer_id ) # Regular_Order_Products ( regular_order_id, product_id ) # Actual_Orders ( actual_order_id, order_status_code, regular_order_id, actual_order_date ) # Actual_Order_Products ( actual_order_id, product_id ) # Customer_Addresses ( customer_id, address_id, date_from, address_type, date_to ) # Delivery_Routes ( route_id, route_name, other_route_details ) # Delivery_Route_Locations ( location_code, route_id, location_address_id, location_name ) # Trucks ( truck_id, truck_licence_number, truck_details ) # Employees ( employee_id, employee_address_id, employee_name, employee_phone ) # Order_Deliveries ( location_code, actual_order_id, delivery_status_code, driver_employee_id, truck_id, delivery_date ) # # Regular_Orders.distributer_id can be joined with Customers.customer_id # Regular_Order_Products.regular_order_id can be joined with Regular_Orders.regular_order_id # Regular_Order_Products.product_id can be joined with Products.product_id # Actual_Orders.regular_order_id can be joined with Regular_Orders.regular_order_id # Actual_Order_Products.actual_order_id can be joined with Actual_Orders.actual_order_id # Actual_Order_Products.product_id can be joined with Products.product_id # Customer_Addresses.address_id can be joined with Addresses.address_id # Customer_Addresses.customer_id can be joined with Customers.customer_id # Delivery_Route_Locations.route_id can be joined with Delivery_Routes.route_id # Delivery_Route_Locations.location_address_id can be joined with Addresses.address_id # Employees.employee_address_id can be joined with Addresses.address_id # Order_Deliveries.driver_employee_id can be joined with Employees.employee_id # Order_Deliveries.location_code can be joined with Delivery_Route_Locations.location_code # Order_Deliveries.actual_order_id can be joined with Actual_Orders.actual_order_id # Order_Deliveries.truck_id can be joined with Trucks.truck_id # ### Question: # # Find the name of the first 5 customers. # ### SQL: # # SELECT customer_name FROM Customers ORDER BY date_became_customer LIMIT 5 # ### End.
customer_deliveries
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Products ( product_id, product_name, product_price, product_description ) # Addresses ( address_id, address_details, city, zip_postcode, state_province_county, country ) # Customers ( customer_id, payment_method, customer_name, customer_phone, customer_email, date_became_customer ) # Regular_Orders ( regular_order_id, distributer_id ) # Regular_Order_Products ( regular_order_id, product_id ) # Actual_Orders ( actual_order_id, order_status_code, regular_order_id, actual_order_date ) # Actual_Order_Products ( actual_order_id, product_id ) # Customer_Addresses ( customer_id, address_id, date_from, address_type, date_to ) # Delivery_Routes ( route_id, route_name, other_route_details ) # Delivery_Route_Locations ( location_code, route_id, location_address_id, location_name ) # Trucks ( truck_id, truck_licence_number, truck_details ) # Employees ( employee_id, employee_address_id, employee_name, employee_phone ) # Order_Deliveries ( location_code, actual_order_id, delivery_status_code, driver_employee_id, truck_id, delivery_date ) # # Regular_Orders.distributer_id can be joined with Customers.customer_id # Regular_Order_Products.regular_order_id can be joined with Regular_Orders.regular_order_id # Regular_Order_Products.product_id can be joined with Products.product_id # Actual_Orders.regular_order_id can be joined with Regular_Orders.regular_order_id # Actual_Order_Products.actual_order_id can be joined with Actual_Orders.actual_order_id # Actual_Order_Products.product_id can be joined with Products.product_id # Customer_Addresses.address_id can be joined with Addresses.address_id # Customer_Addresses.customer_id can be joined with Customers.customer_id # Delivery_Route_Locations.route_id can be joined with Delivery_Routes.route_id # Delivery_Route_Locations.location_address_id can be joined with Addresses.address_id # Employees.employee_address_id can be joined with Addresses.address_id # Order_Deliveries.driver_employee_id can be joined with Employees.employee_id # Order_Deliveries.location_code can be joined with Delivery_Route_Locations.location_code # Order_Deliveries.actual_order_id can be joined with Actual_Orders.actual_order_id # Order_Deliveries.truck_id can be joined with Trucks.truck_id # ### Question: # # Find the payment method that is used most frequently. # ### SQL: # # SELECT payment_method FROM Customers GROUP BY payment_method ORDER BY count(*) DESC LIMIT 1 # ### End.
customer_deliveries
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Products ( product_id, product_name, product_price, product_description ) # Addresses ( address_id, address_details, city, zip_postcode, state_province_county, country ) # Customers ( customer_id, payment_method, customer_name, customer_phone, customer_email, date_became_customer ) # Regular_Orders ( regular_order_id, distributer_id ) # Regular_Order_Products ( regular_order_id, product_id ) # Actual_Orders ( actual_order_id, order_status_code, regular_order_id, actual_order_date ) # Actual_Order_Products ( actual_order_id, product_id ) # Customer_Addresses ( customer_id, address_id, date_from, address_type, date_to ) # Delivery_Routes ( route_id, route_name, other_route_details ) # Delivery_Route_Locations ( location_code, route_id, location_address_id, location_name ) # Trucks ( truck_id, truck_licence_number, truck_details ) # Employees ( employee_id, employee_address_id, employee_name, employee_phone ) # Order_Deliveries ( location_code, actual_order_id, delivery_status_code, driver_employee_id, truck_id, delivery_date ) # # Regular_Orders.distributer_id can be joined with Customers.customer_id # Regular_Order_Products.regular_order_id can be joined with Regular_Orders.regular_order_id # Regular_Order_Products.product_id can be joined with Products.product_id # Actual_Orders.regular_order_id can be joined with Regular_Orders.regular_order_id # Actual_Order_Products.actual_order_id can be joined with Actual_Orders.actual_order_id # Actual_Order_Products.product_id can be joined with Products.product_id # Customer_Addresses.address_id can be joined with Addresses.address_id # Customer_Addresses.customer_id can be joined with Customers.customer_id # Delivery_Route_Locations.route_id can be joined with Delivery_Routes.route_id # Delivery_Route_Locations.location_address_id can be joined with Addresses.address_id # Employees.employee_address_id can be joined with Addresses.address_id # Order_Deliveries.driver_employee_id can be joined with Employees.employee_id # Order_Deliveries.location_code can be joined with Delivery_Route_Locations.location_code # Order_Deliveries.actual_order_id can be joined with Actual_Orders.actual_order_id # Order_Deliveries.truck_id can be joined with Trucks.truck_id # ### Question: # # List the names of all routes in alphabetic order. # ### SQL: # # SELECT route_name FROM Delivery_Routes ORDER BY route_name # ### End.
customer_deliveries
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Products ( product_id, product_name, product_price, product_description ) # Addresses ( address_id, address_details, city, zip_postcode, state_province_county, country ) # Customers ( customer_id, payment_method, customer_name, customer_phone, customer_email, date_became_customer ) # Regular_Orders ( regular_order_id, distributer_id ) # Regular_Order_Products ( regular_order_id, product_id ) # Actual_Orders ( actual_order_id, order_status_code, regular_order_id, actual_order_date ) # Actual_Order_Products ( actual_order_id, product_id ) # Customer_Addresses ( customer_id, address_id, date_from, address_type, date_to ) # Delivery_Routes ( route_id, route_name, other_route_details ) # Delivery_Route_Locations ( location_code, route_id, location_address_id, location_name ) # Trucks ( truck_id, truck_licence_number, truck_details ) # Employees ( employee_id, employee_address_id, employee_name, employee_phone ) # Order_Deliveries ( location_code, actual_order_id, delivery_status_code, driver_employee_id, truck_id, delivery_date ) # # Regular_Orders.distributer_id can be joined with Customers.customer_id # Regular_Order_Products.regular_order_id can be joined with Regular_Orders.regular_order_id # Regular_Order_Products.product_id can be joined with Products.product_id # Actual_Orders.regular_order_id can be joined with Regular_Orders.regular_order_id # Actual_Order_Products.actual_order_id can be joined with Actual_Orders.actual_order_id # Actual_Order_Products.product_id can be joined with Products.product_id # Customer_Addresses.address_id can be joined with Addresses.address_id # Customer_Addresses.customer_id can be joined with Customers.customer_id # Delivery_Route_Locations.route_id can be joined with Delivery_Routes.route_id # Delivery_Route_Locations.location_address_id can be joined with Addresses.address_id # Employees.employee_address_id can be joined with Addresses.address_id # Order_Deliveries.driver_employee_id can be joined with Employees.employee_id # Order_Deliveries.location_code can be joined with Delivery_Route_Locations.location_code # Order_Deliveries.actual_order_id can be joined with Actual_Orders.actual_order_id # Order_Deliveries.truck_id can be joined with Trucks.truck_id # ### Question: # # Find the name of route that has the highest number of deliveries. # ### SQL: # # SELECT t1.route_name FROM Delivery_Routes AS t1 JOIN Delivery_Route_Locations AS t2 ON t1.route_id = t2.route_id GROUP BY t1.route_id ORDER BY count(*) DESC LIMIT 1 # ### End.
customer_deliveries
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Products ( product_id, product_name, product_price, product_description ) # Addresses ( address_id, address_details, city, zip_postcode, state_province_county, country ) # Customers ( customer_id, payment_method, customer_name, customer_phone, customer_email, date_became_customer ) # Regular_Orders ( regular_order_id, distributer_id ) # Regular_Order_Products ( regular_order_id, product_id ) # Actual_Orders ( actual_order_id, order_status_code, regular_order_id, actual_order_date ) # Actual_Order_Products ( actual_order_id, product_id ) # Customer_Addresses ( customer_id, address_id, date_from, address_type, date_to ) # Delivery_Routes ( route_id, route_name, other_route_details ) # Delivery_Route_Locations ( location_code, route_id, location_address_id, location_name ) # Trucks ( truck_id, truck_licence_number, truck_details ) # Employees ( employee_id, employee_address_id, employee_name, employee_phone ) # Order_Deliveries ( location_code, actual_order_id, delivery_status_code, driver_employee_id, truck_id, delivery_date ) # # Regular_Orders.distributer_id can be joined with Customers.customer_id # Regular_Order_Products.regular_order_id can be joined with Regular_Orders.regular_order_id # Regular_Order_Products.product_id can be joined with Products.product_id # Actual_Orders.regular_order_id can be joined with Regular_Orders.regular_order_id # Actual_Order_Products.actual_order_id can be joined with Actual_Orders.actual_order_id # Actual_Order_Products.product_id can be joined with Products.product_id # Customer_Addresses.address_id can be joined with Addresses.address_id # Customer_Addresses.customer_id can be joined with Customers.customer_id # Delivery_Route_Locations.route_id can be joined with Delivery_Routes.route_id # Delivery_Route_Locations.location_address_id can be joined with Addresses.address_id # Employees.employee_address_id can be joined with Addresses.address_id # Order_Deliveries.driver_employee_id can be joined with Employees.employee_id # Order_Deliveries.location_code can be joined with Delivery_Route_Locations.location_code # Order_Deliveries.actual_order_id can be joined with Actual_Orders.actual_order_id # Order_Deliveries.truck_id can be joined with Trucks.truck_id # ### Question: # # List the state names and the number of customers living in each state. # ### SQL: # # SELECT t2.state_province_county , count(*) FROM customer_addresses AS t1 JOIN addresses AS t2 ON t1.address_id = t2.address_id GROUP BY t2.state_province_county # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # How many authors are there? # ### SQL: # # SELECT count(*) FROM authors # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # Count the number of authors. # ### SQL: # # SELECT count(*) FROM authors # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # How many institutions are there? # ### SQL: # # SELECT count(*) FROM inst # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # Count the number of institutions. # ### SQL: # # SELECT count(*) FROM inst # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # How many papers are published in total? # ### SQL: # # SELECT count(*) FROM papers # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # Count the number of total papers. # ### SQL: # # SELECT count(*) FROM papers # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # What are the titles of papers published by "Jeremy Gibbons"? # ### SQL: # # SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Jeremy" AND t1.lname = "Gibbons" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # Find the titles of all the papers written by "Jeremy Gibbons" # ### SQL: # # SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Jeremy" AND t1.lname = "Gibbons" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # Find all the papers published by "Aaron Turon". # ### SQL: # # SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Aaron" AND t1.lname = "Turon" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # Find the titles of all the papers written by "Aaron Turon". # ### SQL: # # SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Aaron" AND t1.lname = "Turon" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # How many papers have "Atsushi Ohori" published? # ### SQL: # # SELECT count(*) FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Atsushi" AND t1.lname = "Ohori" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # How many papers are "Atsushi Ohori" the author of? # ### SQL: # # SELECT count(*) FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Atsushi" AND t1.lname = "Ohori" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # What is the name of the institution that "Matthias Blume" belongs to? # ### SQL: # # SELECT DISTINCT t3.name FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t1.fname = "Matthias" AND t1.lname = "Blume" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # Which institution is the author "Matthias Blume" belong to? Give me the name of the institution. # ### SQL: # # SELECT DISTINCT t3.name FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t1.fname = "Matthias" AND t1.lname = "Blume" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # Which institution does "Katsuhiro Ueno" belong to? # ### SQL: # # SELECT DISTINCT t3.name FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t1.fname = "Katsuhiro" AND t1.lname = "Ueno" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # What is the name of the institution the author "Katsuhiro Ueno" belongs to? # ### SQL: # # SELECT DISTINCT t3.name FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t1.fname = "Katsuhiro" AND t1.lname = "Ueno" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # Who belong to the institution "University of Oxford"? Show the first names and last names. # ### SQL: # # SELECT DISTINCT t1.fname , t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "University of Oxford" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # Find the first names and last names of the authors whose institution affiliation is "University of Oxford". # ### SQL: # # SELECT DISTINCT t1.fname , t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "University of Oxford" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # Which authors belong to the institution "Google"? Show the first names and last names. # ### SQL: # # SELECT DISTINCT t1.fname , t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Google" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # Find the first names and last names of the authors whose institution affiliation is "Google". # ### SQL: # # SELECT DISTINCT t1.fname , t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Google" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # What are the last names of the author of the paper titled "Binders Unbound"? # ### SQL: # # SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title = "Binders Unbound" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # Who is the author of the paper titled "Binders Unbound"? Give me the last name. # ### SQL: # # SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title = "Binders Unbound" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # Find the first and last name of the author(s) who wrote the paper "Nameless, Painless". # ### SQL: # # SELECT t1.fname , t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title = "Nameless , Painless" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # What are the first and last name of the author who published the paper titled "Nameless, Painless"? # ### SQL: # # SELECT t1.fname , t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title = "Nameless , Painless" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # What are the papers published under the institution "Indiana University"? # ### SQL: # # SELECT DISTINCT t1.title FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Indiana University" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # List the titles of the papers whose authors are from the institution "Indiana University". # ### SQL: # # SELECT DISTINCT t1.title FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Indiana University" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # Find all the papers published by the institution "Google". # ### SQL: # # SELECT DISTINCT t1.title FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Google" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # Which papers were written by authors from the institution "Google"? # ### SQL: # # SELECT DISTINCT t1.title FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Google" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # How many papers are published by the institution "Tokohu University"? # ### SQL: # # SELECT count(DISTINCT t1.title) FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Tokohu University" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # Find the number of papers published by authors from the institution "Tokohu University". # ### SQL: # # SELECT count(DISTINCT t1.title) FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Tokohu University" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # Find the number of papers published by the institution "University of Pennsylvania". # ### SQL: # # SELECT count(DISTINCT t1.title) FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "University of Pennsylvania" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # How many papers are written by authors from the institution "University of Pennsylvania"? # ### SQL: # # SELECT count(DISTINCT t1.title) FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "University of Pennsylvania" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # Find the papers which have "Olin Shivers" as an author. # ### SQL: # # SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Olin" AND t1.lname = "Shivers" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # Which papers did the author "Olin Shivers" write? Give me the paper titles. # ### SQL: # # SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Olin" AND t1.lname = "Shivers" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # Which papers have "Stephanie Weirich" as an author? # ### SQL: # # SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Stephanie" AND t1.lname = "Weirich" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # Find the titles of the papers the author "Stephanie Weirich" wrote. # ### SQL: # # SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Stephanie" AND t1.lname = "Weirich" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # Which paper is published in an institution in "USA" and have "Turon" as its second author? # ### SQL: # # SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid JOIN inst AS t4 ON t2.instid = t4.instid WHERE t4.country = "USA" AND t2.authorder = 2 AND t1.lname = "Turon" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # Find papers whose second author has last name "Turon" and is affiliated with an institution in the country "USA". # ### SQL: # # SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid JOIN inst AS t4 ON t2.instid = t4.instid WHERE t4.country = "USA" AND t2.authorder = 2 AND t1.lname = "Turon" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # Find the titles of papers whose first author is affiliated with an institution in the country "Japan" and has last name "Ohori"? # ### SQL: # # SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid JOIN inst AS t4 ON t2.instid = t4.instid WHERE t4.country = "Japan" AND t2.authorder = 1 AND t1.lname = "Ohori" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # Which papers' first author is affiliated with an institution in the country "Japan" and has last name "Ohori"? Give me the titles of the papers. # ### SQL: # # SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid JOIN inst AS t4 ON t2.instid = t4.instid WHERE t4.country = "Japan" AND t2.authorder = 1 AND t1.lname = "Ohori" # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # What is the last name of the author that has published the most papers? # ### SQL: # # SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.fname , t1.lname ORDER BY count(*) DESC LIMIT 1 # ### End.
icfp_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Inst ( instID, name, country ) # Authors ( authID, lname, fname ) # Papers ( paperID, title ) # Authorship ( authID, instID, paperID, authOrder ) # # Authorship.paperID can be joined with Papers.paperID # Authorship.instID can be joined with Inst.instID # Authorship.authID can be joined with Authors.authID # ### Question: # # Which author has written the most papers? Find his or her last name. # ### SQL: # # SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.fname , t1.lname ORDER BY count(*) DESC LIMIT 1 # ### End.