Input:
[INST] Here is a database schema:
event :
Event_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]
Event_Attendance [ INT ]

journalist :
journalist_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]
Years_working [ INT ]

news_report :
journalist_ID [ INT ] primary_key news_report.journalist_ID = journalist.journalist_ID
Event_ID [ INT ] news_report.Event_ID = event.Event_ID
Work_Type [ TEXT ]

Please write me a SQL statement that answers the following question: What are the nationalities and ages of journalists? [/INST]

Output: SELECT Nationality ,  Age FROM journalist;


Input:
[INST] Here is a database schema:
event :
Event_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]
Event_Attendance [ INT ]

journalist :
journalist_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]
Years_working [ INT ]

news_report :
journalist_ID [ INT ] primary_key news_report.journalist_ID = journalist.journalist_ID
Event_ID [ INT ] news_report.Event_ID = event.Event_ID
Work_Type [ TEXT ]

Please write me a SQL statement that answers the following question: Show the names of journalists from "England" or "Wales". [/INST]

Output: SELECT Name FROM journalist WHERE Nationality  =  "England" OR Nationality  =  "Wales";


Input:
[INST] Here is a database schema:
event :
Event_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]
Event_Attendance [ INT ]

journalist :
journalist_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]
Years_working [ INT ]

news_report :
journalist_ID [ INT ] primary_key news_report.journalist_ID = journalist.journalist_ID
Event_ID [ INT ] news_report.Event_ID = event.Event_ID
Work_Type [ TEXT ]

Please write me a SQL statement that answers the following question: What is the average number of years spent working as a journalist? [/INST]

Output: SELECT avg(Years_working) FROM journalist;


Input:
[INST] Here is a database schema:
event :
Event_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]
Event_Attendance [ INT ]

journalist :
journalist_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]
Years_working [ INT ]

news_report :
journalist_ID [ INT ] primary_key news_report.journalist_ID = journalist.journalist_ID
Event_ID [ INT ] news_report.Event_ID = event.Event_ID
Work_Type [ TEXT ]

Please write me a SQL statement that answers the following question: What is the nationality of the journalist with the largest number of years working? [/INST]

Output: SELECT Nationality FROM journalist ORDER BY Years_working DESC LIMIT 1;


Input:
[INST] Here is a database schema:
event :
Event_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]
Event_Attendance [ INT ]

journalist :
journalist_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]
Years_working [ INT ]

news_report :
journalist_ID [ INT ] primary_key news_report.journalist_ID = journalist.journalist_ID
Event_ID [ INT ] news_report.Event_ID = event.Event_ID
Work_Type [ TEXT ]

Please write me a SQL statement that answers the following question: Show the different nationalities and the number of journalists of each nationality. [/INST]

Output: SELECT Nationality ,  COUNT(*) FROM journalist GROUP BY Nationality;


Input:
[INST] Here is a database schema:
event :
Event_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]
Event_Attendance [ INT ]

journalist :
journalist_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]
Years_working [ INT ]

news_report :
journalist_ID [ INT ] primary_key news_report.journalist_ID = journalist.journalist_ID
Event_ID [ INT ] news_report.Event_ID = event.Event_ID
Work_Type [ TEXT ]

Please write me a SQL statement that answers the following question: Show the most common nationality for journalists. [/INST]

Output: SELECT Nationality FROM journalist GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
event :
Event_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]
Event_Attendance [ INT ]

journalist :
journalist_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]
Years_working [ INT ]

news_report :
journalist_ID [ INT ] primary_key news_report.journalist_ID = journalist.journalist_ID
Event_ID [ INT ] news_report.Event_ID = event.Event_ID
Work_Type [ TEXT ]

Please write me a SQL statement that answers the following question: Show the nations that have both journalists with more than 10 years of working and journalists with less than 3 years of working. [/INST]

Output: SELECT Nationality FROM journalist WHERE Years_working  >  10 INTERSECT SELECT Nationality FROM journalist WHERE Years_working  <  3;


Input:
[INST] Here is a database schema:
event :
Event_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]
Event_Attendance [ INT ]

journalist :
journalist_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]
Years_working [ INT ]

news_report :
journalist_ID [ INT ] primary_key news_report.journalist_ID = journalist.journalist_ID
Event_ID [ INT ] news_report.Event_ID = event.Event_ID
Work_Type [ TEXT ]

Please write me a SQL statement that answers the following question: Show the dates, places, and names of events in descending order of the attendance. [/INST]

Output: SELECT Date ,  Name ,  venue FROM event ORDER BY Event_Attendance DESC;


Input:
[INST] Here is a database schema:
event :
Event_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]
Event_Attendance [ INT ]

journalist :
journalist_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]
Years_working [ INT ]

news_report :
journalist_ID [ INT ] primary_key news_report.journalist_ID = journalist.journalist_ID
Event_ID [ INT ] news_report.Event_ID = event.Event_ID
Work_Type [ TEXT ]

Please write me a SQL statement that answers the following question: Show the names of journalists and the dates of the events they reported. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
event :
Event_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]
Event_Attendance [ INT ]

journalist :
journalist_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]
Years_working [ INT ]

news_report :
journalist_ID [ INT ] primary_key news_report.journalist_ID = journalist.journalist_ID
Event_ID [ INT ] news_report.Event_ID = event.Event_ID
Work_Type [ TEXT ]

Please write me a SQL statement that answers the following question: Show the names of journalists and the names of the events they reported in ascending order [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
event :
Event_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]
Event_Attendance [ INT ]

journalist :
journalist_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]
Years_working [ INT ]

news_report :
journalist_ID [ INT ] primary_key news_report.journalist_ID = journalist.journalist_ID
Event_ID [ INT ] news_report.Event_ID = event.Event_ID
Work_Type [ TEXT ]

Please write me a SQL statement that answers the following question: Show the names of journalists and the number of events they reported. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
event :
Event_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]
Event_Attendance [ INT ]

journalist :
journalist_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]
Years_working [ INT ]

news_report :
journalist_ID [ INT ] primary_key news_report.journalist_ID = journalist.journalist_ID
Event_ID [ INT ] news_report.Event_ID = event.Event_ID
Work_Type [ TEXT ]

Please write me a SQL statement that answers the following question: Show the names of journalists that have reported more than one event. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
event :
Event_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]
Event_Attendance [ INT ]

journalist :
journalist_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]
Years_working [ INT ]

news_report :
journalist_ID [ INT ] primary_key news_report.journalist_ID = journalist.journalist_ID
Event_ID [ INT ] news_report.Event_ID = event.Event_ID
Work_Type [ TEXT ]

Please write me a SQL statement that answers the following question: List the names of journalists who have not reported any event. [/INST]

Output: SELECT Name FROM journalist WHERE journalist_ID NOT IN (SELECT journalist_ID FROM news_report);


Input:
[INST] Here is a database schema:
event :
Event_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]
Event_Attendance [ INT ]

journalist :
journalist_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]
Years_working [ INT ]

news_report :
journalist_ID [ INT ] primary_key news_report.journalist_ID = journalist.journalist_ID
Event_ID [ INT ] news_report.Event_ID = event.Event_ID
Work_Type [ TEXT ]

Please write me a SQL statement that answers the following question: what are the average and maximum attendances of all events? [/INST]

Output: SELECT avg(Event_Attendance) ,  max(Event_Attendance) FROM event;


Input:
[INST] Here is a database schema:
event :
Event_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]
Event_Attendance [ INT ]

journalist :
journalist_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]
Years_working [ INT ]

news_report :
journalist_ID [ INT ] primary_key news_report.journalist_ID = journalist.journalist_ID
Event_ID [ INT ] news_report.Event_ID = event.Event_ID
Work_Type [ TEXT ]

Please write me a SQL statement that answers the following question: Find the average age and experience working length of journalists working on different role type. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
event :
Event_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]
Event_Attendance [ INT ]

journalist :
journalist_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]
Years_working [ INT ]

news_report :
journalist_ID [ INT ] primary_key news_report.journalist_ID = journalist.journalist_ID
Event_ID [ INT ] news_report.Event_ID = event.Event_ID
Work_Type [ TEXT ]

Please write me a SQL statement that answers the following question: List the event venues and names that have the top 2 most number of people attended. [/INST]

Output: SELECT venue ,  name FROM event ORDER BY Event_Attendance DESC LIMIT 2;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Restaurant :
ResID [ INT ] primary_key
ResName [ TEXT ]
Address [ TEXT ]
Rating [ INT ]

Type_Of_Restaurant :
ResID [ INT ] Type_Of_Restaurant.ResID = Restaurant.ResID
ResTypeID [ INT ] Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID

Restaurant_Type :
ResTypeID [ INT ] primary_key
ResTypeName [ TEXT ]
ResTypeDescription [ TEXT ]

Visits_Restaurant :
StuID [ INT ] Visits_Restaurant.StuID = Student.StuID
ResID [ INT ] Visits_Restaurant.ResID = Restaurant.ResID
Time [ TEXT ]
Spent [ INT ]

Please write me a SQL statement that answers the following question: Show me all the restaurants. [/INST]

Output: SELECT ResName FROM Restaurant;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Restaurant :
ResID [ INT ] primary_key
ResName [ TEXT ]
Address [ TEXT ]
Rating [ INT ]

Type_Of_Restaurant :
ResID [ INT ] Type_Of_Restaurant.ResID = Restaurant.ResID
ResTypeID [ INT ] Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID

Restaurant_Type :
ResTypeID [ INT ] primary_key
ResTypeName [ TEXT ]
ResTypeDescription [ TEXT ]

Visits_Restaurant :
StuID [ INT ] Visits_Restaurant.StuID = Student.StuID
ResID [ INT ] Visits_Restaurant.ResID = Restaurant.ResID
Time [ TEXT ]
Spent [ INT ]

Please write me a SQL statement that answers the following question: What is the address of the restaurant Subway? [/INST]

Output: SELECT Address FROM Restaurant WHERE ResName = "Subway";


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Restaurant :
ResID [ INT ] primary_key
ResName [ TEXT ]
Address [ TEXT ]
Rating [ INT ]

Type_Of_Restaurant :
ResID [ INT ] Type_Of_Restaurant.ResID = Restaurant.ResID
ResTypeID [ INT ] Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID

Restaurant_Type :
ResTypeID [ INT ] primary_key
ResTypeName [ TEXT ]
ResTypeDescription [ TEXT ]

Visits_Restaurant :
StuID [ INT ] Visits_Restaurant.StuID = Student.StuID
ResID [ INT ] Visits_Restaurant.ResID = Restaurant.ResID
Time [ TEXT ]
Spent [ INT ]

Please write me a SQL statement that answers the following question: What is the rating of the restaurant Subway? [/INST]

Output: SELECT Rating FROM Restaurant WHERE ResName = "Subway";


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Restaurant :
ResID [ INT ] primary_key
ResName [ TEXT ]
Address [ TEXT ]
Rating [ INT ]

Type_Of_Restaurant :
ResID [ INT ] Type_Of_Restaurant.ResID = Restaurant.ResID
ResTypeID [ INT ] Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID

Restaurant_Type :
ResTypeID [ INT ] primary_key
ResTypeName [ TEXT ]
ResTypeDescription [ TEXT ]

Visits_Restaurant :
StuID [ INT ] Visits_Restaurant.StuID = Student.StuID
ResID [ INT ] Visits_Restaurant.ResID = Restaurant.ResID
Time [ TEXT ]
Spent [ INT ]

Please write me a SQL statement that answers the following question: List all restaurant types. [/INST]

Output: SELECT ResTypeName FROM Restaurant_Type;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Restaurant :
ResID [ INT ] primary_key
ResName [ TEXT ]
Address [ TEXT ]
Rating [ INT ]

Type_Of_Restaurant :
ResID [ INT ] Type_Of_Restaurant.ResID = Restaurant.ResID
ResTypeID [ INT ] Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID

Restaurant_Type :
ResTypeID [ INT ] primary_key
ResTypeName [ TEXT ]
ResTypeDescription [ TEXT ]

Visits_Restaurant :
StuID [ INT ] Visits_Restaurant.StuID = Student.StuID
ResID [ INT ] Visits_Restaurant.ResID = Restaurant.ResID
Time [ TEXT ]
Spent [ INT ]

Please write me a SQL statement that answers the following question: What is the description of the restaurant type Sandwich? [/INST]

Output: SELECT ResTypeDescription FROM Restaurant_Type WHERE ResTypeName = "Sandwich";


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Restaurant :
ResID [ INT ] primary_key
ResName [ TEXT ]
Address [ TEXT ]
Rating [ INT ]

Type_Of_Restaurant :
ResID [ INT ] Type_Of_Restaurant.ResID = Restaurant.ResID
ResTypeID [ INT ] Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID

Restaurant_Type :
ResTypeID [ INT ] primary_key
ResTypeName [ TEXT ]
ResTypeDescription [ TEXT ]

Visits_Restaurant :
StuID [ INT ] Visits_Restaurant.StuID = Student.StuID
ResID [ INT ] Visits_Restaurant.ResID = Restaurant.ResID
Time [ TEXT ]
Spent [ INT ]

Please write me a SQL statement that answers the following question: Which restaurants have highest rating? List the restaurant name and its rating. [/INST]

Output: SELECT ResName , Rating FROM Restaurant ORDER BY Rating DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Restaurant :
ResID [ INT ] primary_key
ResName [ TEXT ]
Address [ TEXT ]
Rating [ INT ]

Type_Of_Restaurant :
ResID [ INT ] Type_Of_Restaurant.ResID = Restaurant.ResID
ResTypeID [ INT ] Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID

Restaurant_Type :
ResTypeID [ INT ] primary_key
ResTypeName [ TEXT ]
ResTypeDescription [ TEXT ]

Visits_Restaurant :
StuID [ INT ] Visits_Restaurant.StuID = Student.StuID
ResID [ INT ] Visits_Restaurant.ResID = Restaurant.ResID
Time [ TEXT ]
Spent [ INT ]

Please write me a SQL statement that answers the following question: What is the age of student Linda Smith? [/INST]

Output: SELECT Age FROM Student WHERE Fname = "Linda" AND Lname = "Smith";


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Restaurant :
ResID [ INT ] primary_key
ResName [ TEXT ]
Address [ TEXT ]
Rating [ INT ]

Type_Of_Restaurant :
ResID [ INT ] Type_Of_Restaurant.ResID = Restaurant.ResID
ResTypeID [ INT ] Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID

Restaurant_Type :
ResTypeID [ INT ] primary_key
ResTypeName [ TEXT ]
ResTypeDescription [ TEXT ]

Visits_Restaurant :
StuID [ INT ] Visits_Restaurant.StuID = Student.StuID
ResID [ INT ] Visits_Restaurant.ResID = Restaurant.ResID
Time [ TEXT ]
Spent [ INT ]

Please write me a SQL statement that answers the following question: What is the gender of the student Linda Smith? [/INST]

Output: SELECT Sex FROM Student WHERE Fname = "Linda" AND Lname = "Smith";


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Restaurant :
ResID [ INT ] primary_key
ResName [ TEXT ]
Address [ TEXT ]
Rating [ INT ]

Type_Of_Restaurant :
ResID [ INT ] Type_Of_Restaurant.ResID = Restaurant.ResID
ResTypeID [ INT ] Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID

Restaurant_Type :
ResTypeID [ INT ] primary_key
ResTypeName [ TEXT ]
ResTypeDescription [ TEXT ]

Visits_Restaurant :
StuID [ INT ] Visits_Restaurant.StuID = Student.StuID
ResID [ INT ] Visits_Restaurant.ResID = Restaurant.ResID
Time [ TEXT ]
Spent [ INT ]

Please write me a SQL statement that answers the following question: List all students' first names and last names who majored in 600. [/INST]

Output: SELECT Fname , Lname FROM Student WHERE Major  =  600;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Restaurant :
ResID [ INT ] primary_key
ResName [ TEXT ]
Address [ TEXT ]
Rating [ INT ]

Type_Of_Restaurant :
ResID [ INT ] Type_Of_Restaurant.ResID = Restaurant.ResID
ResTypeID [ INT ] Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID

Restaurant_Type :
ResTypeID [ INT ] primary_key
ResTypeName [ TEXT ]
ResTypeDescription [ TEXT ]

Visits_Restaurant :
StuID [ INT ] Visits_Restaurant.StuID = Student.StuID
ResID [ INT ] Visits_Restaurant.ResID = Restaurant.ResID
Time [ TEXT ]
Spent [ INT ]

Please write me a SQL statement that answers the following question: Which city does student Linda Smith live in? [/INST]

Output: SELECT city_code FROM Student WHERE Fname = "Linda" AND Lname = "Smith";


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Restaurant :
ResID [ INT ] primary_key
ResName [ TEXT ]
Address [ TEXT ]
Rating [ INT ]

Type_Of_Restaurant :
ResID [ INT ] Type_Of_Restaurant.ResID = Restaurant.ResID
ResTypeID [ INT ] Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID

Restaurant_Type :
ResTypeID [ INT ] primary_key
ResTypeName [ TEXT ]
ResTypeDescription [ TEXT ]

Visits_Restaurant :
StuID [ INT ] Visits_Restaurant.StuID = Student.StuID
ResID [ INT ] Visits_Restaurant.ResID = Restaurant.ResID
Time [ TEXT ]
Spent [ INT ]

Please write me a SQL statement that answers the following question: Advisor 1121 has how many students? [/INST]

Output: SELECT count(*) FROM Student WHERE Advisor =  1121;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Restaurant :
ResID [ INT ] primary_key
ResName [ TEXT ]
Address [ TEXT ]
Rating [ INT ]

Type_Of_Restaurant :
ResID [ INT ] Type_Of_Restaurant.ResID = Restaurant.ResID
ResTypeID [ INT ] Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID

Restaurant_Type :
ResTypeID [ INT ] primary_key
ResTypeName [ TEXT ]
ResTypeDescription [ TEXT ]

Visits_Restaurant :
StuID [ INT ] Visits_Restaurant.StuID = Student.StuID
ResID [ INT ] Visits_Restaurant.ResID = Restaurant.ResID
Time [ TEXT ]
Spent [ INT ]

Please write me a SQL statement that answers the following question: Which Advisor has most of students? List advisor and the number of students. [/INST]

Output: SELECT Advisor ,  count(*) FROM Student GROUP BY Advisor ORDER BY count(Advisor) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Restaurant :
ResID [ INT ] primary_key
ResName [ TEXT ]
Address [ TEXT ]
Rating [ INT ]

Type_Of_Restaurant :
ResID [ INT ] Type_Of_Restaurant.ResID = Restaurant.ResID
ResTypeID [ INT ] Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID

Restaurant_Type :
ResTypeID [ INT ] primary_key
ResTypeName [ TEXT ]
ResTypeDescription [ TEXT ]

Visits_Restaurant :
StuID [ INT ] Visits_Restaurant.StuID = Student.StuID
ResID [ INT ] Visits_Restaurant.ResID = Restaurant.ResID
Time [ TEXT ]
Spent [ INT ]

Please write me a SQL statement that answers the following question: Which major has least number of students? List the major and the number of students. [/INST]

Output: SELECT Major ,  count(*) FROM Student GROUP BY Major ORDER BY count(Major) ASC LIMIT 1;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Restaurant :
ResID [ INT ] primary_key
ResName [ TEXT ]
Address [ TEXT ]
Rating [ INT ]

Type_Of_Restaurant :
ResID [ INT ] Type_Of_Restaurant.ResID = Restaurant.ResID
ResTypeID [ INT ] Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID

Restaurant_Type :
ResTypeID [ INT ] primary_key
ResTypeName [ TEXT ]
ResTypeDescription [ TEXT ]

Visits_Restaurant :
StuID [ INT ] Visits_Restaurant.StuID = Student.StuID
ResID [ INT ] Visits_Restaurant.ResID = Restaurant.ResID
Time [ TEXT ]
Spent [ INT ]

Please write me a SQL statement that answers the following question: Which major has between 2 and 30 number of students? List major and the number of students. [/INST]

Output: SELECT Major ,  count(*) FROM Student GROUP BY Major HAVING count(Major) BETWEEN 2 AND 30;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Restaurant :
ResID [ INT ] primary_key
ResName [ TEXT ]
Address [ TEXT ]
Rating [ INT ]

Type_Of_Restaurant :
ResID [ INT ] Type_Of_Restaurant.ResID = Restaurant.ResID
ResTypeID [ INT ] Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID

Restaurant_Type :
ResTypeID [ INT ] primary_key
ResTypeName [ TEXT ]
ResTypeDescription [ TEXT ]

Visits_Restaurant :
StuID [ INT ] Visits_Restaurant.StuID = Student.StuID
ResID [ INT ] Visits_Restaurant.ResID = Restaurant.ResID
Time [ TEXT ]
Spent [ INT ]

Please write me a SQL statement that answers the following question: Which student's age is older than 18 and is majoring in 600? List each student's first and last name. [/INST]

Output: SELECT Fname , Lname FROM Student WHERE Age  >  18 AND Major = 600;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Restaurant :
ResID [ INT ] primary_key
ResName [ TEXT ]
Address [ TEXT ]
Rating [ INT ]

Type_Of_Restaurant :
ResID [ INT ] Type_Of_Restaurant.ResID = Restaurant.ResID
ResTypeID [ INT ] Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID

Restaurant_Type :
ResTypeID [ INT ] primary_key
ResTypeName [ TEXT ]
ResTypeDescription [ TEXT ]

Visits_Restaurant :
StuID [ INT ] Visits_Restaurant.StuID = Student.StuID
ResID [ INT ] Visits_Restaurant.ResID = Restaurant.ResID
Time [ TEXT ]
Spent [ INT ]

Please write me a SQL statement that answers the following question: List all female students age is older than 18 who is not majoring in 600. List students' first name and last name. [/INST]

Output: SELECT Fname , Lname FROM Student WHERE Age  >  18 AND Major != 600 AND Sex = 'F';


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Restaurant :
ResID [ INT ] primary_key
ResName [ TEXT ]
Address [ TEXT ]
Rating [ INT ]

Type_Of_Restaurant :
ResID [ INT ] Type_Of_Restaurant.ResID = Restaurant.ResID
ResTypeID [ INT ] Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID

Restaurant_Type :
ResTypeID [ INT ] primary_key
ResTypeName [ TEXT ]
ResTypeDescription [ TEXT ]

Visits_Restaurant :
StuID [ INT ] Visits_Restaurant.StuID = Student.StuID
ResID [ INT ] Visits_Restaurant.ResID = Restaurant.ResID
Time [ TEXT ]
Spent [ INT ]

Please write me a SQL statement that answers the following question: How many restaurant is the Sandwich type restaurant? [/INST]

Output: 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';


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Restaurant :
ResID [ INT ] primary_key
ResName [ TEXT ]
Address [ TEXT ]
Rating [ INT ]

Type_Of_Restaurant :
ResID [ INT ] Type_Of_Restaurant.ResID = Restaurant.ResID
ResTypeID [ INT ] Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID

Restaurant_Type :
ResTypeID [ INT ] primary_key
ResTypeName [ TEXT ]
ResTypeDescription [ TEXT ]

Visits_Restaurant :
StuID [ INT ] Visits_Restaurant.StuID = Student.StuID
ResID [ INT ] Visits_Restaurant.ResID = Restaurant.ResID
Time [ TEXT ]
Spent [ INT ]

Please write me a SQL statement that answers the following question: How long does student Linda Smith spend on the restaurant in total? [/INST]

Output: SELECT sum(Spent) FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID WHERE Student.Fname = "Linda" AND Student.Lname = "Smith";


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Restaurant :
ResID [ INT ] primary_key
ResName [ TEXT ]
Address [ TEXT ]
Rating [ INT ]

Type_Of_Restaurant :
ResID [ INT ] Type_Of_Restaurant.ResID = Restaurant.ResID
ResTypeID [ INT ] Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID

Restaurant_Type :
ResTypeID [ INT ] primary_key
ResTypeName [ TEXT ]
ResTypeDescription [ TEXT ]

Visits_Restaurant :
StuID [ INT ] Visits_Restaurant.StuID = Student.StuID
ResID [ INT ] Visits_Restaurant.ResID = Restaurant.ResID
Time [ TEXT ]
Spent [ INT ]

Please write me a SQL statement that answers the following question: How many times has the student Linda Smith visited Subway? [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Restaurant :
ResID [ INT ] primary_key
ResName [ TEXT ]
Address [ TEXT ]
Rating [ INT ]

Type_Of_Restaurant :
ResID [ INT ] Type_Of_Restaurant.ResID = Restaurant.ResID
ResTypeID [ INT ] Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID

Restaurant_Type :
ResTypeID [ INT ] primary_key
ResTypeName [ TEXT ]
ResTypeDescription [ TEXT ]

Visits_Restaurant :
StuID [ INT ] Visits_Restaurant.StuID = Student.StuID
ResID [ INT ] Visits_Restaurant.ResID = Restaurant.ResID
Time [ TEXT ]
Spent [ INT ]

Please write me a SQL statement that answers the following question: When did Linda Smith visit Subway? [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Restaurant :
ResID [ INT ] primary_key
ResName [ TEXT ]
Address [ TEXT ]
Rating [ INT ]

Type_Of_Restaurant :
ResID [ INT ] Type_Of_Restaurant.ResID = Restaurant.ResID
ResTypeID [ INT ] Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID

Restaurant_Type :
ResTypeID [ INT ] primary_key
ResTypeName [ TEXT ]
ResTypeDescription [ TEXT ]

Visits_Restaurant :
StuID [ INT ] Visits_Restaurant.StuID = Student.StuID
ResID [ INT ] Visits_Restaurant.ResID = Restaurant.ResID
Time [ TEXT ]
Spent [ INT ]

Please write me a SQL statement that answers the following question: At which restaurant did the students spend the least amount of time? List restaurant and the time students spent on in total. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Student :
StuID [ INT ] primary_key
LName [ TEXT ]
Fname [ TEXT ]
Age [ INT ]
Sex [ TEXT ]
Major [ INT ]
Advisor [ INT ]
city_code [ TEXT ]

Restaurant :
ResID [ INT ] primary_key
ResName [ TEXT ]
Address [ TEXT ]
Rating [ INT ]

Type_Of_Restaurant :
ResID [ INT ] Type_Of_Restaurant.ResID = Restaurant.ResID
ResTypeID [ INT ] Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID

Restaurant_Type :
ResTypeID [ INT ] primary_key
ResTypeName [ TEXT ]
ResTypeDescription [ TEXT ]

Visits_Restaurant :
StuID [ INT ] Visits_Restaurant.StuID = Student.StuID
ResID [ INT ] Visits_Restaurant.ResID = Restaurant.ResID
Time [ TEXT ]
Spent [ INT ]

Please write me a SQL statement that answers the following question: Which student visited restaurant most often? List student's first name and last name. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Products :
product_id [ INT ] primary_key
product_name [ TEXT ]
product_price [ INT ]
product_description [ TEXT ]

Addresses :
address_id [ INT ] primary_key
address_details [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
date_became_customer [ TEXT ]

Regular_Orders :
regular_order_id [ INT ] primary_key
distributer_id [ INT ] Regular_Orders.distributer_id = Customers.customer_id

Regular_Order_Products :
regular_order_id [ INT ] Regular_Order_Products.regular_order_id = Regular_Orders.regular_order_id
product_id [ INT ] Regular_Order_Products.product_id = Products.product_id

Actual_Orders :
actual_order_id [ INT ] primary_key
order_status_code [ TEXT ]
regular_order_id [ INT ] Actual_Orders.regular_order_id = Regular_Orders.regular_order_id
actual_order_date [ TEXT ]

Actual_Order_Products :
actual_order_id [ INT ] Actual_Order_Products.actual_order_id = Actual_Orders.actual_order_id
product_id [ INT ] Actual_Order_Products.product_id = Products.product_id

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
address_type [ TEXT ]
date_to [ TEXT ]

Delivery_Routes :
route_id [ INT ] primary_key
route_name [ TEXT ]
other_route_details [ TEXT ]

Delivery_Route_Locations :
location_code [ TEXT ] primary_key
route_id [ INT ] Delivery_Route_Locations.route_id = Delivery_Routes.route_id
location_address_id [ INT ] Delivery_Route_Locations.location_address_id = Addresses.address_id
location_name [ TEXT ]

Trucks :
truck_id [ INT ] primary_key
truck_licence_number [ TEXT ]
truck_details [ TEXT ]

Employees :
employee_id [ INT ] primary_key
employee_address_id [ INT ] Employees.employee_address_id = Addresses.address_id
employee_name [ TEXT ]
employee_phone [ TEXT ]

Order_Deliveries :
location_code [ TEXT ] Order_Deliveries.location_code = Delivery_Route_Locations.location_code
actual_order_id [ INT ] Order_Deliveries.actual_order_id = Actual_Orders.actual_order_id
delivery_status_code [ TEXT ]
driver_employee_id [ INT ] Order_Deliveries.driver_employee_id = Employees.employee_id
truck_id [ INT ] Order_Deliveries.truck_id = Trucks.truck_id
delivery_date [ TEXT ]

Please write me a SQL statement that answers the following question: Find the ids of orders whose status is 'Success'. [/INST]

Output: SELECT actual_order_id FROM actual_orders WHERE order_status_code  =  'Success';


Input:
[INST] Here is a database schema:
Products :
product_id [ INT ] primary_key
product_name [ TEXT ]
product_price [ INT ]
product_description [ TEXT ]

Addresses :
address_id [ INT ] primary_key
address_details [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
date_became_customer [ TEXT ]

Regular_Orders :
regular_order_id [ INT ] primary_key
distributer_id [ INT ] Regular_Orders.distributer_id = Customers.customer_id

Regular_Order_Products :
regular_order_id [ INT ] Regular_Order_Products.regular_order_id = Regular_Orders.regular_order_id
product_id [ INT ] Regular_Order_Products.product_id = Products.product_id

Actual_Orders :
actual_order_id [ INT ] primary_key
order_status_code [ TEXT ]
regular_order_id [ INT ] Actual_Orders.regular_order_id = Regular_Orders.regular_order_id
actual_order_date [ TEXT ]

Actual_Order_Products :
actual_order_id [ INT ] Actual_Order_Products.actual_order_id = Actual_Orders.actual_order_id
product_id [ INT ] Actual_Order_Products.product_id = Products.product_id

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
address_type [ TEXT ]
date_to [ TEXT ]

Delivery_Routes :
route_id [ INT ] primary_key
route_name [ TEXT ]
other_route_details [ TEXT ]

Delivery_Route_Locations :
location_code [ TEXT ] primary_key
route_id [ INT ] Delivery_Route_Locations.route_id = Delivery_Routes.route_id
location_address_id [ INT ] Delivery_Route_Locations.location_address_id = Addresses.address_id
location_name [ TEXT ]

Trucks :
truck_id [ INT ] primary_key
truck_licence_number [ TEXT ]
truck_details [ TEXT ]

Employees :
employee_id [ INT ] primary_key
employee_address_id [ INT ] Employees.employee_address_id = Addresses.address_id
employee_name [ TEXT ]
employee_phone [ TEXT ]

Order_Deliveries :
location_code [ TEXT ] Order_Deliveries.location_code = Delivery_Route_Locations.location_code
actual_order_id [ INT ] Order_Deliveries.actual_order_id = Actual_Orders.actual_order_id
delivery_status_code [ TEXT ]
driver_employee_id [ INT ] Order_Deliveries.driver_employee_id = Employees.employee_id
truck_id [ INT ] Order_Deliveries.truck_id = Trucks.truck_id
delivery_date [ TEXT ]

Please write me a SQL statement that answers the following question: Find the name and price of the product that has been ordered the greatest number of times. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Products :
product_id [ INT ] primary_key
product_name [ TEXT ]
product_price [ INT ]
product_description [ TEXT ]

Addresses :
address_id [ INT ] primary_key
address_details [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
date_became_customer [ TEXT ]

Regular_Orders :
regular_order_id [ INT ] primary_key
distributer_id [ INT ] Regular_Orders.distributer_id = Customers.customer_id

Regular_Order_Products :
regular_order_id [ INT ] Regular_Order_Products.regular_order_id = Regular_Orders.regular_order_id
product_id [ INT ] Regular_Order_Products.product_id = Products.product_id

Actual_Orders :
actual_order_id [ INT ] primary_key
order_status_code [ TEXT ]
regular_order_id [ INT ] Actual_Orders.regular_order_id = Regular_Orders.regular_order_id
actual_order_date [ TEXT ]

Actual_Order_Products :
actual_order_id [ INT ] Actual_Order_Products.actual_order_id = Actual_Orders.actual_order_id
product_id [ INT ] Actual_Order_Products.product_id = Products.product_id

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
address_type [ TEXT ]
date_to [ TEXT ]

Delivery_Routes :
route_id [ INT ] primary_key
route_name [ TEXT ]
other_route_details [ TEXT ]

Delivery_Route_Locations :
location_code [ TEXT ] primary_key
route_id [ INT ] Delivery_Route_Locations.route_id = Delivery_Routes.route_id
location_address_id [ INT ] Delivery_Route_Locations.location_address_id = Addresses.address_id
location_name [ TEXT ]

Trucks :
truck_id [ INT ] primary_key
truck_licence_number [ TEXT ]
truck_details [ TEXT ]

Employees :
employee_id [ INT ] primary_key
employee_address_id [ INT ] Employees.employee_address_id = Addresses.address_id
employee_name [ TEXT ]
employee_phone [ TEXT ]

Order_Deliveries :
location_code [ TEXT ] Order_Deliveries.location_code = Delivery_Route_Locations.location_code
actual_order_id [ INT ] Order_Deliveries.actual_order_id = Actual_Orders.actual_order_id
delivery_status_code [ TEXT ]
driver_employee_id [ INT ] Order_Deliveries.driver_employee_id = Employees.employee_id
truck_id [ INT ] Order_Deliveries.truck_id = Trucks.truck_id
delivery_date [ TEXT ]

Please write me a SQL statement that answers the following question: Find the number of customers in total. [/INST]

Output: SELECT count(*) FROM customers;


Input:
[INST] Here is a database schema:
Products :
product_id [ INT ] primary_key
product_name [ TEXT ]
product_price [ INT ]
product_description [ TEXT ]

Addresses :
address_id [ INT ] primary_key
address_details [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
date_became_customer [ TEXT ]

Regular_Orders :
regular_order_id [ INT ] primary_key
distributer_id [ INT ] Regular_Orders.distributer_id = Customers.customer_id

Regular_Order_Products :
regular_order_id [ INT ] Regular_Order_Products.regular_order_id = Regular_Orders.regular_order_id
product_id [ INT ] Regular_Order_Products.product_id = Products.product_id

Actual_Orders :
actual_order_id [ INT ] primary_key
order_status_code [ TEXT ]
regular_order_id [ INT ] Actual_Orders.regular_order_id = Regular_Orders.regular_order_id
actual_order_date [ TEXT ]

Actual_Order_Products :
actual_order_id [ INT ] Actual_Order_Products.actual_order_id = Actual_Orders.actual_order_id
product_id [ INT ] Actual_Order_Products.product_id = Products.product_id

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
address_type [ TEXT ]
date_to [ TEXT ]

Delivery_Routes :
route_id [ INT ] primary_key
route_name [ TEXT ]
other_route_details [ TEXT ]

Delivery_Route_Locations :
location_code [ TEXT ] primary_key
route_id [ INT ] Delivery_Route_Locations.route_id = Delivery_Routes.route_id
location_address_id [ INT ] Delivery_Route_Locations.location_address_id = Addresses.address_id
location_name [ TEXT ]

Trucks :
truck_id [ INT ] primary_key
truck_licence_number [ TEXT ]
truck_details [ TEXT ]

Employees :
employee_id [ INT ] primary_key
employee_address_id [ INT ] Employees.employee_address_id = Addresses.address_id
employee_name [ TEXT ]
employee_phone [ TEXT ]

Order_Deliveries :
location_code [ TEXT ] Order_Deliveries.location_code = Delivery_Route_Locations.location_code
actual_order_id [ INT ] Order_Deliveries.actual_order_id = Actual_Orders.actual_order_id
delivery_status_code [ TEXT ]
driver_employee_id [ INT ] Order_Deliveries.driver_employee_id = Employees.employee_id
truck_id [ INT ] Order_Deliveries.truck_id = Trucks.truck_id
delivery_date [ TEXT ]

Please write me a SQL statement that answers the following question: How many different payment methods are there? [/INST]

Output: SELECT count(DISTINCT payment_method) FROM customers;


Input:
[INST] Here is a database schema:
Products :
product_id [ INT ] primary_key
product_name [ TEXT ]
product_price [ INT ]
product_description [ TEXT ]

Addresses :
address_id [ INT ] primary_key
address_details [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
date_became_customer [ TEXT ]

Regular_Orders :
regular_order_id [ INT ] primary_key
distributer_id [ INT ] Regular_Orders.distributer_id = Customers.customer_id

Regular_Order_Products :
regular_order_id [ INT ] Regular_Order_Products.regular_order_id = Regular_Orders.regular_order_id
product_id [ INT ] Regular_Order_Products.product_id = Products.product_id

Actual_Orders :
actual_order_id [ INT ] primary_key
order_status_code [ TEXT ]
regular_order_id [ INT ] Actual_Orders.regular_order_id = Regular_Orders.regular_order_id
actual_order_date [ TEXT ]

Actual_Order_Products :
actual_order_id [ INT ] Actual_Order_Products.actual_order_id = Actual_Orders.actual_order_id
product_id [ INT ] Actual_Order_Products.product_id = Products.product_id

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
address_type [ TEXT ]
date_to [ TEXT ]

Delivery_Routes :
route_id [ INT ] primary_key
route_name [ TEXT ]
other_route_details [ TEXT ]

Delivery_Route_Locations :
location_code [ TEXT ] primary_key
route_id [ INT ] Delivery_Route_Locations.route_id = Delivery_Routes.route_id
location_address_id [ INT ] Delivery_Route_Locations.location_address_id = Addresses.address_id
location_name [ TEXT ]

Trucks :
truck_id [ INT ] primary_key
truck_licence_number [ TEXT ]
truck_details [ TEXT ]

Employees :
employee_id [ INT ] primary_key
employee_address_id [ INT ] Employees.employee_address_id = Addresses.address_id
employee_name [ TEXT ]
employee_phone [ TEXT ]

Order_Deliveries :
location_code [ TEXT ] Order_Deliveries.location_code = Delivery_Route_Locations.location_code
actual_order_id [ INT ] Order_Deliveries.actual_order_id = Actual_Orders.actual_order_id
delivery_status_code [ TEXT ]
driver_employee_id [ INT ] Order_Deliveries.driver_employee_id = Employees.employee_id
truck_id [ INT ] Order_Deliveries.truck_id = Trucks.truck_id
delivery_date [ TEXT ]

Please write me a SQL statement that answers the following question: Show the details of all trucks in the order of their license number. [/INST]

Output: SELECT truck_details FROM trucks ORDER BY truck_licence_number;


Input:
[INST] Here is a database schema:
Products :
product_id [ INT ] primary_key
product_name [ TEXT ]
product_price [ INT ]
product_description [ TEXT ]

Addresses :
address_id [ INT ] primary_key
address_details [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
date_became_customer [ TEXT ]

Regular_Orders :
regular_order_id [ INT ] primary_key
distributer_id [ INT ] Regular_Orders.distributer_id = Customers.customer_id

Regular_Order_Products :
regular_order_id [ INT ] Regular_Order_Products.regular_order_id = Regular_Orders.regular_order_id
product_id [ INT ] Regular_Order_Products.product_id = Products.product_id

Actual_Orders :
actual_order_id [ INT ] primary_key
order_status_code [ TEXT ]
regular_order_id [ INT ] Actual_Orders.regular_order_id = Regular_Orders.regular_order_id
actual_order_date [ TEXT ]

Actual_Order_Products :
actual_order_id [ INT ] Actual_Order_Products.actual_order_id = Actual_Orders.actual_order_id
product_id [ INT ] Actual_Order_Products.product_id = Products.product_id

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
address_type [ TEXT ]
date_to [ TEXT ]

Delivery_Routes :
route_id [ INT ] primary_key
route_name [ TEXT ]
other_route_details [ TEXT ]

Delivery_Route_Locations :
location_code [ TEXT ] primary_key
route_id [ INT ] Delivery_Route_Locations.route_id = Delivery_Routes.route_id
location_address_id [ INT ] Delivery_Route_Locations.location_address_id = Addresses.address_id
location_name [ TEXT ]

Trucks :
truck_id [ INT ] primary_key
truck_licence_number [ TEXT ]
truck_details [ TEXT ]

Employees :
employee_id [ INT ] primary_key
employee_address_id [ INT ] Employees.employee_address_id = Addresses.address_id
employee_name [ TEXT ]
employee_phone [ TEXT ]

Order_Deliveries :
location_code [ TEXT ] Order_Deliveries.location_code = Delivery_Route_Locations.location_code
actual_order_id [ INT ] Order_Deliveries.actual_order_id = Actual_Orders.actual_order_id
delivery_status_code [ TEXT ]
driver_employee_id [ INT ] Order_Deliveries.driver_employee_id = Employees.employee_id
truck_id [ INT ] Order_Deliveries.truck_id = Trucks.truck_id
delivery_date [ TEXT ]

Please write me a SQL statement that answers the following question: Find the name of the most expensive product. [/INST]

Output: SELECT product_name FROM products ORDER BY product_price DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Products :
product_id [ INT ] primary_key
product_name [ TEXT ]
product_price [ INT ]
product_description [ TEXT ]

Addresses :
address_id [ INT ] primary_key
address_details [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
date_became_customer [ TEXT ]

Regular_Orders :
regular_order_id [ INT ] primary_key
distributer_id [ INT ] Regular_Orders.distributer_id = Customers.customer_id

Regular_Order_Products :
regular_order_id [ INT ] Regular_Order_Products.regular_order_id = Regular_Orders.regular_order_id
product_id [ INT ] Regular_Order_Products.product_id = Products.product_id

Actual_Orders :
actual_order_id [ INT ] primary_key
order_status_code [ TEXT ]
regular_order_id [ INT ] Actual_Orders.regular_order_id = Regular_Orders.regular_order_id
actual_order_date [ TEXT ]

Actual_Order_Products :
actual_order_id [ INT ] Actual_Order_Products.actual_order_id = Actual_Orders.actual_order_id
product_id [ INT ] Actual_Order_Products.product_id = Products.product_id

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
address_type [ TEXT ]
date_to [ TEXT ]

Delivery_Routes :
route_id [ INT ] primary_key
route_name [ TEXT ]
other_route_details [ TEXT ]

Delivery_Route_Locations :
location_code [ TEXT ] primary_key
route_id [ INT ] Delivery_Route_Locations.route_id = Delivery_Routes.route_id
location_address_id [ INT ] Delivery_Route_Locations.location_address_id = Addresses.address_id
location_name [ TEXT ]

Trucks :
truck_id [ INT ] primary_key
truck_licence_number [ TEXT ]
truck_details [ TEXT ]

Employees :
employee_id [ INT ] primary_key
employee_address_id [ INT ] Employees.employee_address_id = Addresses.address_id
employee_name [ TEXT ]
employee_phone [ TEXT ]

Order_Deliveries :
location_code [ TEXT ] Order_Deliveries.location_code = Delivery_Route_Locations.location_code
actual_order_id [ INT ] Order_Deliveries.actual_order_id = Actual_Orders.actual_order_id
delivery_status_code [ TEXT ]
driver_employee_id [ INT ] Order_Deliveries.driver_employee_id = Employees.employee_id
truck_id [ INT ] Order_Deliveries.truck_id = Trucks.truck_id
delivery_date [ TEXT ]

Please write me a SQL statement that answers the following question: Find the names of customers who are not living in the state of California. [/INST]

Output: 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';


Input:
[INST] Here is a database schema:
Products :
product_id [ INT ] primary_key
product_name [ TEXT ]
product_price [ INT ]
product_description [ TEXT ]

Addresses :
address_id [ INT ] primary_key
address_details [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
date_became_customer [ TEXT ]

Regular_Orders :
regular_order_id [ INT ] primary_key
distributer_id [ INT ] Regular_Orders.distributer_id = Customers.customer_id

Regular_Order_Products :
regular_order_id [ INT ] Regular_Order_Products.regular_order_id = Regular_Orders.regular_order_id
product_id [ INT ] Regular_Order_Products.product_id = Products.product_id

Actual_Orders :
actual_order_id [ INT ] primary_key
order_status_code [ TEXT ]
regular_order_id [ INT ] Actual_Orders.regular_order_id = Regular_Orders.regular_order_id
actual_order_date [ TEXT ]

Actual_Order_Products :
actual_order_id [ INT ] Actual_Order_Products.actual_order_id = Actual_Orders.actual_order_id
product_id [ INT ] Actual_Order_Products.product_id = Products.product_id

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
address_type [ TEXT ]
date_to [ TEXT ]

Delivery_Routes :
route_id [ INT ] primary_key
route_name [ TEXT ]
other_route_details [ TEXT ]

Delivery_Route_Locations :
location_code [ TEXT ] primary_key
route_id [ INT ] Delivery_Route_Locations.route_id = Delivery_Routes.route_id
location_address_id [ INT ] Delivery_Route_Locations.location_address_id = Addresses.address_id
location_name [ TEXT ]

Trucks :
truck_id [ INT ] primary_key
truck_licence_number [ TEXT ]
truck_details [ TEXT ]

Employees :
employee_id [ INT ] primary_key
employee_address_id [ INT ] Employees.employee_address_id = Addresses.address_id
employee_name [ TEXT ]
employee_phone [ TEXT ]

Order_Deliveries :
location_code [ TEXT ] Order_Deliveries.location_code = Delivery_Route_Locations.location_code
actual_order_id [ INT ] Order_Deliveries.actual_order_id = Actual_Orders.actual_order_id
delivery_status_code [ TEXT ]
driver_employee_id [ INT ] Order_Deliveries.driver_employee_id = Employees.employee_id
truck_id [ INT ] Order_Deliveries.truck_id = Trucks.truck_id
delivery_date [ TEXT ]

Please write me a SQL statement that answers the following question: List the names and emails of customers who payed by Visa card. [/INST]

Output: SELECT customer_email ,  customer_name FROM customers WHERE payment_method  =  'Visa';


Input:
[INST] Here is a database schema:
Products :
product_id [ INT ] primary_key
product_name [ TEXT ]
product_price [ INT ]
product_description [ TEXT ]

Addresses :
address_id [ INT ] primary_key
address_details [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
date_became_customer [ TEXT ]

Regular_Orders :
regular_order_id [ INT ] primary_key
distributer_id [ INT ] Regular_Orders.distributer_id = Customers.customer_id

Regular_Order_Products :
regular_order_id [ INT ] Regular_Order_Products.regular_order_id = Regular_Orders.regular_order_id
product_id [ INT ] Regular_Order_Products.product_id = Products.product_id

Actual_Orders :
actual_order_id [ INT ] primary_key
order_status_code [ TEXT ]
regular_order_id [ INT ] Actual_Orders.regular_order_id = Regular_Orders.regular_order_id
actual_order_date [ TEXT ]

Actual_Order_Products :
actual_order_id [ INT ] Actual_Order_Products.actual_order_id = Actual_Orders.actual_order_id
product_id [ INT ] Actual_Order_Products.product_id = Products.product_id

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
address_type [ TEXT ]
date_to [ TEXT ]

Delivery_Routes :
route_id [ INT ] primary_key
route_name [ TEXT ]
other_route_details [ TEXT ]

Delivery_Route_Locations :
location_code [ TEXT ] primary_key
route_id [ INT ] Delivery_Route_Locations.route_id = Delivery_Routes.route_id
location_address_id [ INT ] Delivery_Route_Locations.location_address_id = Addresses.address_id
location_name [ TEXT ]

Trucks :
truck_id [ INT ] primary_key
truck_licence_number [ TEXT ]
truck_details [ TEXT ]

Employees :
employee_id [ INT ] primary_key
employee_address_id [ INT ] Employees.employee_address_id = Addresses.address_id
employee_name [ TEXT ]
employee_phone [ TEXT ]

Order_Deliveries :
location_code [ TEXT ] Order_Deliveries.location_code = Delivery_Route_Locations.location_code
actual_order_id [ INT ] Order_Deliveries.actual_order_id = Actual_Orders.actual_order_id
delivery_status_code [ TEXT ]
driver_employee_id [ INT ] Order_Deliveries.driver_employee_id = Employees.employee_id
truck_id [ INT ] Order_Deliveries.truck_id = Trucks.truck_id
delivery_date [ TEXT ]

Please write me a SQL statement that answers the following question: Find the names and phone numbers of customers living in California state. [/INST]

Output: 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';


Input:
[INST] Here is a database schema:
Products :
product_id [ INT ] primary_key
product_name [ TEXT ]
product_price [ INT ]
product_description [ TEXT ]

Addresses :
address_id [ INT ] primary_key
address_details [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
date_became_customer [ TEXT ]

Regular_Orders :
regular_order_id [ INT ] primary_key
distributer_id [ INT ] Regular_Orders.distributer_id = Customers.customer_id

Regular_Order_Products :
regular_order_id [ INT ] Regular_Order_Products.regular_order_id = Regular_Orders.regular_order_id
product_id [ INT ] Regular_Order_Products.product_id = Products.product_id

Actual_Orders :
actual_order_id [ INT ] primary_key
order_status_code [ TEXT ]
regular_order_id [ INT ] Actual_Orders.regular_order_id = Regular_Orders.regular_order_id
actual_order_date [ TEXT ]

Actual_Order_Products :
actual_order_id [ INT ] Actual_Order_Products.actual_order_id = Actual_Orders.actual_order_id
product_id [ INT ] Actual_Order_Products.product_id = Products.product_id

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
address_type [ TEXT ]
date_to [ TEXT ]

Delivery_Routes :
route_id [ INT ] primary_key
route_name [ TEXT ]
other_route_details [ TEXT ]

Delivery_Route_Locations :
location_code [ TEXT ] primary_key
route_id [ INT ] Delivery_Route_Locations.route_id = Delivery_Routes.route_id
location_address_id [ INT ] Delivery_Route_Locations.location_address_id = Addresses.address_id
location_name [ TEXT ]

Trucks :
truck_id [ INT ] primary_key
truck_licence_number [ TEXT ]
truck_details [ TEXT ]

Employees :
employee_id [ INT ] primary_key
employee_address_id [ INT ] Employees.employee_address_id = Addresses.address_id
employee_name [ TEXT ]
employee_phone [ TEXT ]

Order_Deliveries :
location_code [ TEXT ] Order_Deliveries.location_code = Delivery_Route_Locations.location_code
actual_order_id [ INT ] Order_Deliveries.actual_order_id = Actual_Orders.actual_order_id
delivery_status_code [ TEXT ]
driver_employee_id [ INT ] Order_Deliveries.driver_employee_id = Employees.employee_id
truck_id [ INT ] Order_Deliveries.truck_id = Trucks.truck_id
delivery_date [ TEXT ]

Please write me a SQL statement that answers the following question: Find the states which do not have any employee in their record. [/INST]

Output: SELECT state_province_county FROM addresses WHERE address_id NOT IN (SELECT employee_address_id FROM Employees);


Input:
[INST] Here is a database schema:
Products :
product_id [ INT ] primary_key
product_name [ TEXT ]
product_price [ INT ]
product_description [ TEXT ]

Addresses :
address_id [ INT ] primary_key
address_details [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
date_became_customer [ TEXT ]

Regular_Orders :
regular_order_id [ INT ] primary_key
distributer_id [ INT ] Regular_Orders.distributer_id = Customers.customer_id

Regular_Order_Products :
regular_order_id [ INT ] Regular_Order_Products.regular_order_id = Regular_Orders.regular_order_id
product_id [ INT ] Regular_Order_Products.product_id = Products.product_id

Actual_Orders :
actual_order_id [ INT ] primary_key
order_status_code [ TEXT ]
regular_order_id [ INT ] Actual_Orders.regular_order_id = Regular_Orders.regular_order_id
actual_order_date [ TEXT ]

Actual_Order_Products :
actual_order_id [ INT ] Actual_Order_Products.actual_order_id = Actual_Orders.actual_order_id
product_id [ INT ] Actual_Order_Products.product_id = Products.product_id

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
address_type [ TEXT ]
date_to [ TEXT ]

Delivery_Routes :
route_id [ INT ] primary_key
route_name [ TEXT ]
other_route_details [ TEXT ]

Delivery_Route_Locations :
location_code [ TEXT ] primary_key
route_id [ INT ] Delivery_Route_Locations.route_id = Delivery_Routes.route_id
location_address_id [ INT ] Delivery_Route_Locations.location_address_id = Addresses.address_id
location_name [ TEXT ]

Trucks :
truck_id [ INT ] primary_key
truck_licence_number [ TEXT ]
truck_details [ TEXT ]

Employees :
employee_id [ INT ] primary_key
employee_address_id [ INT ] Employees.employee_address_id = Addresses.address_id
employee_name [ TEXT ]
employee_phone [ TEXT ]

Order_Deliveries :
location_code [ TEXT ] Order_Deliveries.location_code = Delivery_Route_Locations.location_code
actual_order_id [ INT ] Order_Deliveries.actual_order_id = Actual_Orders.actual_order_id
delivery_status_code [ TEXT ]
driver_employee_id [ INT ] Order_Deliveries.driver_employee_id = Employees.employee_id
truck_id [ INT ] Order_Deliveries.truck_id = Trucks.truck_id
delivery_date [ TEXT ]

Please write me a SQL statement that answers the following question: List the names, phone numbers, and emails of all customers sorted by their dates of becoming customers. [/INST]

Output: SELECT customer_name ,  customer_phone ,  customer_email FROM Customers ORDER BY date_became_customer;


Input:
[INST] Here is a database schema:
Products :
product_id [ INT ] primary_key
product_name [ TEXT ]
product_price [ INT ]
product_description [ TEXT ]

Addresses :
address_id [ INT ] primary_key
address_details [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
date_became_customer [ TEXT ]

Regular_Orders :
regular_order_id [ INT ] primary_key
distributer_id [ INT ] Regular_Orders.distributer_id = Customers.customer_id

Regular_Order_Products :
regular_order_id [ INT ] Regular_Order_Products.regular_order_id = Regular_Orders.regular_order_id
product_id [ INT ] Regular_Order_Products.product_id = Products.product_id

Actual_Orders :
actual_order_id [ INT ] primary_key
order_status_code [ TEXT ]
regular_order_id [ INT ] Actual_Orders.regular_order_id = Regular_Orders.regular_order_id
actual_order_date [ TEXT ]

Actual_Order_Products :
actual_order_id [ INT ] Actual_Order_Products.actual_order_id = Actual_Orders.actual_order_id
product_id [ INT ] Actual_Order_Products.product_id = Products.product_id

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
address_type [ TEXT ]
date_to [ TEXT ]

Delivery_Routes :
route_id [ INT ] primary_key
route_name [ TEXT ]
other_route_details [ TEXT ]

Delivery_Route_Locations :
location_code [ TEXT ] primary_key
route_id [ INT ] Delivery_Route_Locations.route_id = Delivery_Routes.route_id
location_address_id [ INT ] Delivery_Route_Locations.location_address_id = Addresses.address_id
location_name [ TEXT ]

Trucks :
truck_id [ INT ] primary_key
truck_licence_number [ TEXT ]
truck_details [ TEXT ]

Employees :
employee_id [ INT ] primary_key
employee_address_id [ INT ] Employees.employee_address_id = Addresses.address_id
employee_name [ TEXT ]
employee_phone [ TEXT ]

Order_Deliveries :
location_code [ TEXT ] Order_Deliveries.location_code = Delivery_Route_Locations.location_code
actual_order_id [ INT ] Order_Deliveries.actual_order_id = Actual_Orders.actual_order_id
delivery_status_code [ TEXT ]
driver_employee_id [ INT ] Order_Deliveries.driver_employee_id = Employees.employee_id
truck_id [ INT ] Order_Deliveries.truck_id = Trucks.truck_id
delivery_date [ TEXT ]

Please write me a SQL statement that answers the following question: Find the name of the first 5 customers. [/INST]

Output: SELECT customer_name FROM Customers ORDER BY date_became_customer LIMIT 5;


Input:
[INST] Here is a database schema:
Products :
product_id [ INT ] primary_key
product_name [ TEXT ]
product_price [ INT ]
product_description [ TEXT ]

Addresses :
address_id [ INT ] primary_key
address_details [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
date_became_customer [ TEXT ]

Regular_Orders :
regular_order_id [ INT ] primary_key
distributer_id [ INT ] Regular_Orders.distributer_id = Customers.customer_id

Regular_Order_Products :
regular_order_id [ INT ] Regular_Order_Products.regular_order_id = Regular_Orders.regular_order_id
product_id [ INT ] Regular_Order_Products.product_id = Products.product_id

Actual_Orders :
actual_order_id [ INT ] primary_key
order_status_code [ TEXT ]
regular_order_id [ INT ] Actual_Orders.regular_order_id = Regular_Orders.regular_order_id
actual_order_date [ TEXT ]

Actual_Order_Products :
actual_order_id [ INT ] Actual_Order_Products.actual_order_id = Actual_Orders.actual_order_id
product_id [ INT ] Actual_Order_Products.product_id = Products.product_id

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
address_type [ TEXT ]
date_to [ TEXT ]

Delivery_Routes :
route_id [ INT ] primary_key
route_name [ TEXT ]
other_route_details [ TEXT ]

Delivery_Route_Locations :
location_code [ TEXT ] primary_key
route_id [ INT ] Delivery_Route_Locations.route_id = Delivery_Routes.route_id
location_address_id [ INT ] Delivery_Route_Locations.location_address_id = Addresses.address_id
location_name [ TEXT ]

Trucks :
truck_id [ INT ] primary_key
truck_licence_number [ TEXT ]
truck_details [ TEXT ]

Employees :
employee_id [ INT ] primary_key
employee_address_id [ INT ] Employees.employee_address_id = Addresses.address_id
employee_name [ TEXT ]
employee_phone [ TEXT ]

Order_Deliveries :
location_code [ TEXT ] Order_Deliveries.location_code = Delivery_Route_Locations.location_code
actual_order_id [ INT ] Order_Deliveries.actual_order_id = Actual_Orders.actual_order_id
delivery_status_code [ TEXT ]
driver_employee_id [ INT ] Order_Deliveries.driver_employee_id = Employees.employee_id
truck_id [ INT ] Order_Deliveries.truck_id = Trucks.truck_id
delivery_date [ TEXT ]

Please write me a SQL statement that answers the following question: Find the payment method that is used most frequently. [/INST]

Output: SELECT payment_method FROM Customers GROUP BY payment_method ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Products :
product_id [ INT ] primary_key
product_name [ TEXT ]
product_price [ INT ]
product_description [ TEXT ]

Addresses :
address_id [ INT ] primary_key
address_details [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
date_became_customer [ TEXT ]

Regular_Orders :
regular_order_id [ INT ] primary_key
distributer_id [ INT ] Regular_Orders.distributer_id = Customers.customer_id

Regular_Order_Products :
regular_order_id [ INT ] Regular_Order_Products.regular_order_id = Regular_Orders.regular_order_id
product_id [ INT ] Regular_Order_Products.product_id = Products.product_id

Actual_Orders :
actual_order_id [ INT ] primary_key
order_status_code [ TEXT ]
regular_order_id [ INT ] Actual_Orders.regular_order_id = Regular_Orders.regular_order_id
actual_order_date [ TEXT ]

Actual_Order_Products :
actual_order_id [ INT ] Actual_Order_Products.actual_order_id = Actual_Orders.actual_order_id
product_id [ INT ] Actual_Order_Products.product_id = Products.product_id

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
address_type [ TEXT ]
date_to [ TEXT ]

Delivery_Routes :
route_id [ INT ] primary_key
route_name [ TEXT ]
other_route_details [ TEXT ]

Delivery_Route_Locations :
location_code [ TEXT ] primary_key
route_id [ INT ] Delivery_Route_Locations.route_id = Delivery_Routes.route_id
location_address_id [ INT ] Delivery_Route_Locations.location_address_id = Addresses.address_id
location_name [ TEXT ]

Trucks :
truck_id [ INT ] primary_key
truck_licence_number [ TEXT ]
truck_details [ TEXT ]

Employees :
employee_id [ INT ] primary_key
employee_address_id [ INT ] Employees.employee_address_id = Addresses.address_id
employee_name [ TEXT ]
employee_phone [ TEXT ]

Order_Deliveries :
location_code [ TEXT ] Order_Deliveries.location_code = Delivery_Route_Locations.location_code
actual_order_id [ INT ] Order_Deliveries.actual_order_id = Actual_Orders.actual_order_id
delivery_status_code [ TEXT ]
driver_employee_id [ INT ] Order_Deliveries.driver_employee_id = Employees.employee_id
truck_id [ INT ] Order_Deliveries.truck_id = Trucks.truck_id
delivery_date [ TEXT ]

Please write me a SQL statement that answers the following question: List the names of all routes in alphabetic order. [/INST]

Output: SELECT route_name FROM Delivery_Routes ORDER BY route_name;


Input:
[INST] Here is a database schema:
Products :
product_id [ INT ] primary_key
product_name [ TEXT ]
product_price [ INT ]
product_description [ TEXT ]

Addresses :
address_id [ INT ] primary_key
address_details [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
date_became_customer [ TEXT ]

Regular_Orders :
regular_order_id [ INT ] primary_key
distributer_id [ INT ] Regular_Orders.distributer_id = Customers.customer_id

Regular_Order_Products :
regular_order_id [ INT ] Regular_Order_Products.regular_order_id = Regular_Orders.regular_order_id
product_id [ INT ] Regular_Order_Products.product_id = Products.product_id

Actual_Orders :
actual_order_id [ INT ] primary_key
order_status_code [ TEXT ]
regular_order_id [ INT ] Actual_Orders.regular_order_id = Regular_Orders.regular_order_id
actual_order_date [ TEXT ]

Actual_Order_Products :
actual_order_id [ INT ] Actual_Order_Products.actual_order_id = Actual_Orders.actual_order_id
product_id [ INT ] Actual_Order_Products.product_id = Products.product_id

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
address_type [ TEXT ]
date_to [ TEXT ]

Delivery_Routes :
route_id [ INT ] primary_key
route_name [ TEXT ]
other_route_details [ TEXT ]

Delivery_Route_Locations :
location_code [ TEXT ] primary_key
route_id [ INT ] Delivery_Route_Locations.route_id = Delivery_Routes.route_id
location_address_id [ INT ] Delivery_Route_Locations.location_address_id = Addresses.address_id
location_name [ TEXT ]

Trucks :
truck_id [ INT ] primary_key
truck_licence_number [ TEXT ]
truck_details [ TEXT ]

Employees :
employee_id [ INT ] primary_key
employee_address_id [ INT ] Employees.employee_address_id = Addresses.address_id
employee_name [ TEXT ]
employee_phone [ TEXT ]

Order_Deliveries :
location_code [ TEXT ] Order_Deliveries.location_code = Delivery_Route_Locations.location_code
actual_order_id [ INT ] Order_Deliveries.actual_order_id = Actual_Orders.actual_order_id
delivery_status_code [ TEXT ]
driver_employee_id [ INT ] Order_Deliveries.driver_employee_id = Employees.employee_id
truck_id [ INT ] Order_Deliveries.truck_id = Trucks.truck_id
delivery_date [ TEXT ]

Please write me a SQL statement that answers the following question: Find the name of route that has the highest number of deliveries. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Products :
product_id [ INT ] primary_key
product_name [ TEXT ]
product_price [ INT ]
product_description [ TEXT ]

Addresses :
address_id [ INT ] primary_key
address_details [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

Customers :
customer_id [ INT ] primary_key
payment_method [ TEXT ]
customer_name [ TEXT ]
customer_phone [ TEXT ]
customer_email [ TEXT ]
date_became_customer [ TEXT ]

Regular_Orders :
regular_order_id [ INT ] primary_key
distributer_id [ INT ] Regular_Orders.distributer_id = Customers.customer_id

Regular_Order_Products :
regular_order_id [ INT ] Regular_Order_Products.regular_order_id = Regular_Orders.regular_order_id
product_id [ INT ] Regular_Order_Products.product_id = Products.product_id

Actual_Orders :
actual_order_id [ INT ] primary_key
order_status_code [ TEXT ]
regular_order_id [ INT ] Actual_Orders.regular_order_id = Regular_Orders.regular_order_id
actual_order_date [ TEXT ]

Actual_Order_Products :
actual_order_id [ INT ] Actual_Order_Products.actual_order_id = Actual_Orders.actual_order_id
product_id [ INT ] Actual_Order_Products.product_id = Products.product_id

Customer_Addresses :
customer_id [ INT ] Customer_Addresses.customer_id = Customers.customer_id
address_id [ INT ] Customer_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
address_type [ TEXT ]
date_to [ TEXT ]

Delivery_Routes :
route_id [ INT ] primary_key
route_name [ TEXT ]
other_route_details [ TEXT ]

Delivery_Route_Locations :
location_code [ TEXT ] primary_key
route_id [ INT ] Delivery_Route_Locations.route_id = Delivery_Routes.route_id
location_address_id [ INT ] Delivery_Route_Locations.location_address_id = Addresses.address_id
location_name [ TEXT ]

Trucks :
truck_id [ INT ] primary_key
truck_licence_number [ TEXT ]
truck_details [ TEXT ]

Employees :
employee_id [ INT ] primary_key
employee_address_id [ INT ] Employees.employee_address_id = Addresses.address_id
employee_name [ TEXT ]
employee_phone [ TEXT ]

Order_Deliveries :
location_code [ TEXT ] Order_Deliveries.location_code = Delivery_Route_Locations.location_code
actual_order_id [ INT ] Order_Deliveries.actual_order_id = Actual_Orders.actual_order_id
delivery_status_code [ TEXT ]
driver_employee_id [ INT ] Order_Deliveries.driver_employee_id = Employees.employee_id
truck_id [ INT ] Order_Deliveries.truck_id = Trucks.truck_id
delivery_date [ TEXT ]

Please write me a SQL statement that answers the following question: List the state names and the number of customers living in each state. [/INST]

Output: 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;


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: How many authors are there? [/INST]

Output: SELECT count(*) FROM authors;


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: Count the number of authors. [/INST]

Output: SELECT count(*) FROM authors;


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: How many institutions are there? [/INST]

Output: SELECT count(*) FROM inst;


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: Count the number of institutions. [/INST]

Output: SELECT count(*) FROM inst;


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: How many papers are published in total? [/INST]

Output: SELECT count(*) FROM papers;


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: Count the number of total papers. [/INST]

Output: SELECT count(*) FROM papers;


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: What are the titles of papers published by "Jeremy Gibbons"? [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: Find the titles of all the papers written by "Jeremy Gibbons" [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: Find all the papers published by "Aaron Turon". [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: Find the titles of all the papers written by "Aaron Turon". [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: How many papers have "Atsushi Ohori" published? [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: How many papers are "Atsushi Ohori" the author of? [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: What is the name of the institution that "Matthias Blume" belongs to? [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: Which institution is the author "Matthias Blume" belong to? Give me the name of the institution. [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: Which institution does "Katsuhiro Ueno" belong to? [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: What is the name of the institution the author "Katsuhiro Ueno" belongs to? [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: Who belong to the institution "University of Oxford"? Show the first names and last names. [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: Find the first names and last names of the authors whose institution affiliation is "University of Oxford". [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: Which authors belong to the institution "Google"? Show the first names and last names. [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: Find the first names and last names of the authors whose institution affiliation is "Google". [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: What are the last names of the author of the paper titled "Binders Unbound"? [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: Who is the author of the paper titled "Binders Unbound"? Give me the last name. [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: Find the first and last name of the author(s) who wrote the paper "Nameless, Painless". [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: What are the first and last name of the author who published the paper titled "Nameless, Painless"? [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: What are the papers published under the institution "Indiana University"? [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: List the titles of the papers whose authors are from the institution "Indiana University". [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: Find all the papers published by the institution "Google". [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: Which papers were written by authors from the institution "Google"? [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: How many papers are published by the institution "Tokohu University"? [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: Find the number of papers published by authors from the institution "Tokohu University". [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: Find the number of papers published by the institution "University of Pennsylvania". [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: How many papers are written by authors from the institution "University of Pennsylvania"? [/INST]

Output: 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";


Input:
[INST] Here is a database schema:
Inst :
instID [ INT ] primary_key
name [ TEXT ]
country [ TEXT ]

Authors :
authID [ INT ] primary_key
lname [ TEXT ]
fname [ TEXT ]

Papers :
paperID [ INT ] primary_key
title [ TEXT ]

Authorship :
authID [ INT ] primary_key Authorship.authID = Authors.authID
instID [ INT ] Authorship.instID = Inst.instID
paperID [ INT ] Authorship.paperID = Papers.paperID
authOrder [ INT ]

Please write me a SQL statement that answers the following question: Find the papers which have "Olin Shivers" as an author. [/INST]

Output: 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";