Input:
[INST] Here is a database schema:
member :
Member_ID [ INT ] primary_key
Card_Number [ TEXT ]
Name [ TEXT ]
Hometown [ TEXT ]
Level [ INT ]

branch :
Branch_ID [ INT ] primary_key
Name [ TEXT ]
Open_year [ TEXT ]
Address_road [ TEXT ]
City [ TEXT ]
membership_amount [ TEXT ]

membership_register_branch :
Member_ID [ INT ] primary_key membership_register_branch.Member_ID = member.Member_ID
Branch_ID [ TEXT ] membership_register_branch.Branch_ID = branch.Branch_ID
Register_Year [ TEXT ]

purchase :
Member_ID [ INT ] primary_key purchase.Member_ID = member.Member_ID
Branch_ID [ TEXT ] purchase.Branch_ID = branch.Branch_ID
Year [ TEXT ]
Total_pounds [ INT ]

Please write me a SQL statement that answers the following question: What are the cities that have a branch that opened in 2001 and a branch with more than 100 members? [/INST]

Output: SELECT city FROM branch WHERE open_year  =  2001 AND membership_amount  >  100;


Input:
[INST] Here is a database schema:
member :
Member_ID [ INT ] primary_key
Card_Number [ TEXT ]
Name [ TEXT ]
Hometown [ TEXT ]
Level [ INT ]

branch :
Branch_ID [ INT ] primary_key
Name [ TEXT ]
Open_year [ TEXT ]
Address_road [ TEXT ]
City [ TEXT ]
membership_amount [ TEXT ]

membership_register_branch :
Member_ID [ INT ] primary_key membership_register_branch.Member_ID = member.Member_ID
Branch_ID [ TEXT ] membership_register_branch.Branch_ID = branch.Branch_ID
Register_Year [ TEXT ]

purchase :
Member_ID [ INT ] primary_key purchase.Member_ID = member.Member_ID
Branch_ID [ TEXT ] purchase.Branch_ID = branch.Branch_ID
Year [ TEXT ]
Total_pounds [ INT ]

Please write me a SQL statement that answers the following question: Show all cities without a branch having more than 100 memberships. [/INST]

Output: SELECT city FROM branch EXCEPT SELECT city FROM branch WHERE membership_amount  >  100;


Input:
[INST] Here is a database schema:
member :
Member_ID [ INT ] primary_key
Card_Number [ TEXT ]
Name [ TEXT ]
Hometown [ TEXT ]
Level [ INT ]

branch :
Branch_ID [ INT ] primary_key
Name [ TEXT ]
Open_year [ TEXT ]
Address_road [ TEXT ]
City [ TEXT ]
membership_amount [ TEXT ]

membership_register_branch :
Member_ID [ INT ] primary_key membership_register_branch.Member_ID = member.Member_ID
Branch_ID [ TEXT ] membership_register_branch.Branch_ID = branch.Branch_ID
Register_Year [ TEXT ]

purchase :
Member_ID [ INT ] primary_key purchase.Member_ID = member.Member_ID
Branch_ID [ TEXT ] purchase.Branch_ID = branch.Branch_ID
Year [ TEXT ]
Total_pounds [ INT ]

Please write me a SQL statement that answers the following question: What are the cities that do not have any branches with more than 100 members? [/INST]

Output: SELECT city FROM branch EXCEPT SELECT city FROM branch WHERE membership_amount  >  100;


Input:
[INST] Here is a database schema:
member :
Member_ID [ INT ] primary_key
Card_Number [ TEXT ]
Name [ TEXT ]
Hometown [ TEXT ]
Level [ INT ]

branch :
Branch_ID [ INT ] primary_key
Name [ TEXT ]
Open_year [ TEXT ]
Address_road [ TEXT ]
City [ TEXT ]
membership_amount [ TEXT ]

membership_register_branch :
Member_ID [ INT ] primary_key membership_register_branch.Member_ID = member.Member_ID
Branch_ID [ TEXT ] membership_register_branch.Branch_ID = branch.Branch_ID
Register_Year [ TEXT ]

purchase :
Member_ID [ INT ] primary_key purchase.Member_ID = member.Member_ID
Branch_ID [ TEXT ] purchase.Branch_ID = branch.Branch_ID
Year [ TEXT ]
Total_pounds [ INT ]

Please write me a SQL statement that answers the following question: What is the sum of total pounds of purchase in year 2018 for all branches in London? [/INST]

Output: SELECT sum(total_pounds) FROM purchase AS T1 JOIN branch AS T2 ON T1.branch_id  =  T2.branch_id WHERE T2.city  =  'London' AND T1.year  =  2018;


Input:
[INST] Here is a database schema:
member :
Member_ID [ INT ] primary_key
Card_Number [ TEXT ]
Name [ TEXT ]
Hometown [ TEXT ]
Level [ INT ]

branch :
Branch_ID [ INT ] primary_key
Name [ TEXT ]
Open_year [ TEXT ]
Address_road [ TEXT ]
City [ TEXT ]
membership_amount [ TEXT ]

membership_register_branch :
Member_ID [ INT ] primary_key membership_register_branch.Member_ID = member.Member_ID
Branch_ID [ TEXT ] membership_register_branch.Branch_ID = branch.Branch_ID
Register_Year [ TEXT ]

purchase :
Member_ID [ INT ] primary_key purchase.Member_ID = member.Member_ID
Branch_ID [ TEXT ] purchase.Branch_ID = branch.Branch_ID
Year [ TEXT ]
Total_pounds [ INT ]

Please write me a SQL statement that answers the following question: How many total pounds were purchased in the year 2018 at all London branches? [/INST]

Output: SELECT sum(total_pounds) FROM purchase AS T1 JOIN branch AS T2 ON T1.branch_id  =  T2.branch_id WHERE T2.city  =  'London' AND T1.year  =  2018;


Input:
[INST] Here is a database schema:
member :
Member_ID [ INT ] primary_key
Card_Number [ TEXT ]
Name [ TEXT ]
Hometown [ TEXT ]
Level [ INT ]

branch :
Branch_ID [ INT ] primary_key
Name [ TEXT ]
Open_year [ TEXT ]
Address_road [ TEXT ]
City [ TEXT ]
membership_amount [ TEXT ]

membership_register_branch :
Member_ID [ INT ] primary_key membership_register_branch.Member_ID = member.Member_ID
Branch_ID [ TEXT ] membership_register_branch.Branch_ID = branch.Branch_ID
Register_Year [ TEXT ]

purchase :
Member_ID [ INT ] primary_key purchase.Member_ID = member.Member_ID
Branch_ID [ TEXT ] purchase.Branch_ID = branch.Branch_ID
Year [ TEXT ]
Total_pounds [ INT ]

Please write me a SQL statement that answers the following question: What is the total number of purchases for members with level 6? [/INST]

Output: SELECT count(*) FROM purchase AS T1 JOIN member AS T2 ON T1.member_id  =  T2.member_id WHERE T2.level  =  6;


Input:
[INST] Here is a database schema:
member :
Member_ID [ INT ] primary_key
Card_Number [ TEXT ]
Name [ TEXT ]
Hometown [ TEXT ]
Level [ INT ]

branch :
Branch_ID [ INT ] primary_key
Name [ TEXT ]
Open_year [ TEXT ]
Address_road [ TEXT ]
City [ TEXT ]
membership_amount [ TEXT ]

membership_register_branch :
Member_ID [ INT ] primary_key membership_register_branch.Member_ID = member.Member_ID
Branch_ID [ TEXT ] membership_register_branch.Branch_ID = branch.Branch_ID
Register_Year [ TEXT ]

purchase :
Member_ID [ INT ] primary_key purchase.Member_ID = member.Member_ID
Branch_ID [ TEXT ] purchase.Branch_ID = branch.Branch_ID
Year [ TEXT ]
Total_pounds [ INT ]

Please write me a SQL statement that answers the following question: What are the total purchases for members rated at level 6? [/INST]

Output: SELECT count(*) FROM purchase AS T1 JOIN member AS T2 ON T1.member_id  =  T2.member_id WHERE T2.level  =  6;


Input:
[INST] Here is a database schema:
member :
Member_ID [ INT ] primary_key
Card_Number [ TEXT ]
Name [ TEXT ]
Hometown [ TEXT ]
Level [ INT ]

branch :
Branch_ID [ INT ] primary_key
Name [ TEXT ]
Open_year [ TEXT ]
Address_road [ TEXT ]
City [ TEXT ]
membership_amount [ TEXT ]

membership_register_branch :
Member_ID [ INT ] primary_key membership_register_branch.Member_ID = member.Member_ID
Branch_ID [ TEXT ] membership_register_branch.Branch_ID = branch.Branch_ID
Register_Year [ TEXT ]

purchase :
Member_ID [ INT ] primary_key purchase.Member_ID = member.Member_ID
Branch_ID [ TEXT ] purchase.Branch_ID = branch.Branch_ID
Year [ TEXT ]
Total_pounds [ INT ]

Please write me a SQL statement that answers the following question: Find the name of branches where have some members whose hometown is in Louisville, Kentucky and some in Hiram, Georgia. [/INST]

Output: SELECT T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id  =  T2.branch_id JOIN member AS T3 ON T1.member_id  =  T3.member_id WHERE T3.Hometown  =  'Louisville ,  Kentucky' INTERSECT SELECT T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id  =  T2.branch_id JOIN member AS T3 ON T1.member_id  =  T3.member_id WHERE T3.Hometown  =  'Hiram ,  Georgia';


Input:
[INST] Here is a database schema:
member :
Member_ID [ INT ] primary_key
Card_Number [ TEXT ]
Name [ TEXT ]
Hometown [ TEXT ]
Level [ INT ]

branch :
Branch_ID [ INT ] primary_key
Name [ TEXT ]
Open_year [ TEXT ]
Address_road [ TEXT ]
City [ TEXT ]
membership_amount [ TEXT ]

membership_register_branch :
Member_ID [ INT ] primary_key membership_register_branch.Member_ID = member.Member_ID
Branch_ID [ TEXT ] membership_register_branch.Branch_ID = branch.Branch_ID
Register_Year [ TEXT ]

purchase :
Member_ID [ INT ] primary_key purchase.Member_ID = member.Member_ID
Branch_ID [ TEXT ] purchase.Branch_ID = branch.Branch_ID
Year [ TEXT ]
Total_pounds [ INT ]

Please write me a SQL statement that answers the following question: What are the names of the branches that have some members with a hometown in Louisville, Kentucky and also those from Hiram, Goergia? [/INST]

Output: SELECT T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id  =  T2.branch_id JOIN member AS T3 ON T1.member_id  =  T3.member_id WHERE T3.Hometown  =  'Louisville ,  Kentucky' INTERSECT SELECT T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id  =  T2.branch_id JOIN member AS T3 ON T1.member_id  =  T3.member_id WHERE T3.Hometown  =  'Hiram ,  Georgia';


Input:
[INST] Here is a database schema:
member :
Member_ID [ INT ] primary_key
Card_Number [ TEXT ]
Name [ TEXT ]
Hometown [ TEXT ]
Level [ INT ]

branch :
Branch_ID [ INT ] primary_key
Name [ TEXT ]
Open_year [ TEXT ]
Address_road [ TEXT ]
City [ TEXT ]
membership_amount [ TEXT ]

membership_register_branch :
Member_ID [ INT ] primary_key membership_register_branch.Member_ID = member.Member_ID
Branch_ID [ TEXT ] membership_register_branch.Branch_ID = branch.Branch_ID
Register_Year [ TEXT ]

purchase :
Member_ID [ INT ] primary_key purchase.Member_ID = member.Member_ID
Branch_ID [ TEXT ] purchase.Branch_ID = branch.Branch_ID
Year [ TEXT ]
Total_pounds [ INT ]

Please write me a SQL statement that answers the following question: list the card number of all members whose hometown address includes word "Kentucky". [/INST]

Output: SELECT card_number FROM member WHERE Hometown LIKE "%Kentucky%";


Input:
[INST] Here is a database schema:
member :
Member_ID [ INT ] primary_key
Card_Number [ TEXT ]
Name [ TEXT ]
Hometown [ TEXT ]
Level [ INT ]

branch :
Branch_ID [ INT ] primary_key
Name [ TEXT ]
Open_year [ TEXT ]
Address_road [ TEXT ]
City [ TEXT ]
membership_amount [ TEXT ]

membership_register_branch :
Member_ID [ INT ] primary_key membership_register_branch.Member_ID = member.Member_ID
Branch_ID [ TEXT ] membership_register_branch.Branch_ID = branch.Branch_ID
Register_Year [ TEXT ]

purchase :
Member_ID [ INT ] primary_key purchase.Member_ID = member.Member_ID
Branch_ID [ TEXT ] purchase.Branch_ID = branch.Branch_ID
Year [ TEXT ]
Total_pounds [ INT ]

Please write me a SQL statement that answers the following question: What are the card numbers of members from Kentucky? [/INST]

Output: SELECT card_number FROM member WHERE Hometown LIKE "%Kentucky%";


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

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

Output: SELECT count(*) FROM STUDENT;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

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

Output: SELECT count(*) FROM STUDENT;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

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

Output: SELECT count(*) FROM VOTING_RECORD;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: How many voting records do we have? [/INST]

Output: SELECT count(*) FROM VOTING_RECORD;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Find the distinct number of president votes. [/INST]

Output: SELECT count(DISTINCT President_Vote) FROM VOTING_RECORD;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: How many distinct president votes are recorded? [/INST]

Output: SELECT count(DISTINCT President_Vote) FROM VOTING_RECORD;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Find the maximum age of all the students. [/INST]

Output: SELECT max(Age) FROM STUDENT;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: What is the oldest age among the students? [/INST]

Output: SELECT max(Age) FROM STUDENT;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Find the last names of students with major 50. [/INST]

Output: SELECT LName FROM STUDENT WHERE Major  =  50;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: What are the last names of students studying major 50? [/INST]

Output: SELECT LName FROM STUDENT WHERE Major  =  50;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Find the first names of students with age above 22. [/INST]

Output: SELECT Fname FROM STUDENT WHERE Age  >  22;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: What are the first names of all the students aged above 22? [/INST]

Output: SELECT Fname FROM STUDENT WHERE Age  >  22;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: What are the majors of male (sex is M) students? [/INST]

Output: SELECT Major FROM STUDENT WHERE Sex  =  "M";


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: List the major of each male student. [/INST]

Output: SELECT Major FROM STUDENT WHERE Sex  =  "M";


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: What is the average age of female (sex is F) students? [/INST]

Output: SELECT avg(Age) FROM STUDENT WHERE 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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Find the average age of female students. [/INST]

Output: SELECT avg(Age) FROM STUDENT WHERE 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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: What are the maximum and minimum age of students with major 600? [/INST]

Output: SELECT max(Age) ,  min(Age) 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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Tell me the ages of the oldest and youngest students studying major 600. [/INST]

Output: SELECT max(Age) ,  min(Age) 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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Who are the advisors for students that live in a city with city code "BAL"? [/INST]

Output: SELECT Advisor FROM STUDENT WHERE city_code  =  "BAL";


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Show the advisors of the students whose city of residence has city code "BAL". [/INST]

Output: SELECT Advisor FROM STUDENT WHERE city_code  =  "BAL";


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: What are the distinct secretary votes in the fall election cycle? [/INST]

Output: SELECT DISTINCT Secretary_Vote FROM VOTING_RECORD WHERE ELECTION_CYCLE  =  "Fall";


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Return all the distinct secretary votes made in the fall election cycle. [/INST]

Output: SELECT DISTINCT Secretary_Vote FROM VOTING_RECORD WHERE ELECTION_CYCLE  =  "Fall";


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: What are the distinct president votes on 08/30/2015? [/INST]

Output: SELECT DISTINCT PRESIDENT_Vote FROM VOTING_RECORD WHERE Registration_Date  =  "08/30/2015";


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Show all the distinct president votes made on 08/30/2015. [/INST]

Output: SELECT DISTINCT PRESIDENT_Vote FROM VOTING_RECORD WHERE Registration_Date  =  "08/30/2015";


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Report the distinct registration date and the election cycle. [/INST]

Output: SELECT DISTINCT Registration_Date ,  Election_Cycle FROM VOTING_RECORD;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: What are the distinct registration dates and the election cycles? [/INST]

Output: SELECT DISTINCT Registration_Date ,  Election_Cycle FROM VOTING_RECORD;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Report the distinct president vote and the vice president vote. [/INST]

Output: SELECT DISTINCT President_Vote ,  VICE_President_Vote FROM VOTING_RECORD;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: List all the distinct president votes and the vice president votes. [/INST]

Output: SELECT DISTINCT President_Vote ,  VICE_President_Vote FROM VOTING_RECORD;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Find the distinct last names of the students who have class president votes. [/INST]

Output: SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  T2.CLASS_President_VOTE;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: What are the distinct last names of the students who have class president votes? [/INST]

Output: SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  T2.CLASS_President_VOTE;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Find the distinct first names of the students who have class senator votes. [/INST]

Output: SELECT DISTINCT T1.Fname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  T2.CLASS_Senator_VOTE;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: What are the distinct first names of the students who have class president votes? [/INST]

Output: SELECT DISTINCT T1.Fname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  T2.CLASS_Senator_VOTE;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Find the distinct ages of students who have secretary votes in the fall election cycle. [/INST]

Output: SELECT DISTINCT T1.Age FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  T2.Secretary_Vote WHERE T2.Election_Cycle  =  "Fall";


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: What are the distinct ages of students who have secretary votes in the fall election cycle? [/INST]

Output: SELECT DISTINCT T1.Age FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  T2.Secretary_Vote WHERE T2.Election_Cycle  =  "Fall";


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Find the distinct Advisor of students who have treasurer votes in the spring election cycle. [/INST]

Output: SELECT DISTINCT T1.Advisor FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  T2.Treasurer_Vote WHERE T2.Election_Cycle  =  "Spring";


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Who served as an advisor for students who have treasurer votes in the spring election cycle? [/INST]

Output: SELECT DISTINCT T1.Advisor FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  T2.Treasurer_Vote WHERE T2.Election_Cycle  =  "Spring";


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Find the distinct majors of students who have treasurer votes. [/INST]

Output: SELECT DISTINCT T1.Major FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  T2.Treasurer_Vote;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: What are the distinct majors that students with treasurer votes are studying? [/INST]

Output: SELECT DISTINCT T1.Major FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  T2.Treasurer_Vote;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Find the first and last names of all the female (sex is F) students who have president votes. [/INST]

Output: SELECT DISTINCT T1.Fname ,  T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  T2.President_VOTE WHERE T1.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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: What are the first and last names of all the female students who have president votes? [/INST]

Output: SELECT DISTINCT T1.Fname ,  T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  T2.President_VOTE WHERE T1.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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Find the first and last name of all the students of age 18 who have vice president votes. [/INST]

Output: SELECT DISTINCT T1.Fname ,  T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  T2.VICE_President_VOTE WHERE T1.age  =  18;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: What are the first names and last names of the students who are 18 years old and have vice president votes. [/INST]

Output: SELECT DISTINCT T1.Fname ,  T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  T2.VICE_President_VOTE WHERE T1.age  =  18;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: How many male (sex is M) students have class senator votes in the fall election cycle? [/INST]

Output: SELECT count(*) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  Class_Senator_Vote WHERE T1.Sex  =  "M" AND T2.Election_Cycle  =  "Fall";


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Count the number of male students who had class senator votes in the fall election cycle. [/INST]

Output: SELECT count(*) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  Class_Senator_Vote WHERE T1.Sex  =  "M" AND T2.Election_Cycle  =  "Fall";


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Find the number of students whose city code is NYC and who have class senator votes in the spring election cycle. [/INST]

Output: SELECT count(*) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  Class_Senator_Vote WHERE T1.city_code  =  "NYC" AND T2.Election_Cycle  =  "Spring";


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Which students live in the city with code "NYC" and have class senator votes in the spring election cycle? Count the numbers. [/INST]

Output: SELECT count(*) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  Class_Senator_Vote WHERE T1.city_code  =  "NYC" AND T2.Election_Cycle  =  "Spring";


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Find the average age of students who live in the city with code "NYC" and have secretary votes in the spring election cycle. [/INST]

Output: SELECT avg(T1.Age) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  SECRETARY_Vote WHERE T1.city_code  =  "NYC" AND T2.Election_Cycle  =  "Spring";


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: What is the average age of students who have city code "NYC" and have secretary votes for the spring election cycle? [/INST]

Output: SELECT avg(T1.Age) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  SECRETARY_Vote WHERE T1.city_code  =  "NYC" AND T2.Election_Cycle  =  "Spring";


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Find the average age of female (sex is F) students who have secretary votes in the spring election cycle. [/INST]

Output: SELECT avg(T1.Age) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  SECRETARY_Vote WHERE T1.Sex  =  "F" AND T2.Election_Cycle  =  "Spring";


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: What is the average age of the female students with secretary votes in the spring election cycle? [/INST]

Output: SELECT avg(T1.Age) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  SECRETARY_Vote WHERE T1.Sex  =  "F" AND T2.Election_Cycle  =  "Spring";


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Find the distinct first names of all the students who have vice president votes and whose city code is not PIT. [/INST]

Output: SELECT DISTINCT T1.Fname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  T2.VICE_PRESIDENT_Vote EXCEPT SELECT DISTINCT Fname FROM STUDENT WHERE city_code  =  "PIT";


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: What are the distinct first names of the students who have vice president votes and reside in a city whose city code is not PIT? [/INST]

Output: SELECT DISTINCT T1.Fname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  T2.VICE_PRESIDENT_Vote EXCEPT SELECT DISTINCT Fname FROM STUDENT WHERE city_code  =  "PIT";


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Find the distinct last names of all the students who have president votes and whose advisor is not 2192. [/INST]

Output: SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  PRESIDENT_Vote EXCEPT SELECT DISTINCT LName FROM STUDENT WHERE Advisor  =  "2192";


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: What are the distinct last names of the students who have president votes but do not have 2192 as the advisor? [/INST]

Output: SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  PRESIDENT_Vote EXCEPT SELECT DISTINCT LName FROM STUDENT WHERE Advisor  =  "2192";


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Find the distinct last names of all the students who have president votes and whose advisor is 8741. [/INST]

Output: SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  PRESIDENT_Vote INTERSECT SELECT DISTINCT LName FROM STUDENT WHERE Advisor  =  "8741";


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: What are the distinct last names of the students who have president votes and have 8741 as the advisor? [/INST]

Output: SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  PRESIDENT_Vote INTERSECT SELECT DISTINCT LName FROM STUDENT WHERE Advisor  =  "8741";


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: For each advisor, report the total number of students advised by him or her. [/INST]

Output: SELECT Advisor ,  count(*) FROM STUDENT GROUP BY Advisor;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: How many students does each advisor have? [/INST]

Output: SELECT Advisor ,  count(*) FROM STUDENT GROUP BY Advisor;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Report all advisors that advise more than 2 students. [/INST]

Output: SELECT Advisor FROM STUDENT GROUP BY Advisor HAVING COUNT(*)  >  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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Which advisors have more than two students? [/INST]

Output: SELECT Advisor FROM STUDENT GROUP BY Advisor HAVING COUNT(*)  >  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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Report all majors that have less than 3 students. [/INST]

Output: SELECT Major FROM STUDENT GROUP BY Major HAVING COUNT(*)  <  3;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: What are the majors only less than three students are studying? [/INST]

Output: SELECT Major FROM STUDENT GROUP BY Major HAVING COUNT(*)  <  3;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: For each election cycle, report the number of voting records. [/INST]

Output: SELECT Election_Cycle ,  count(*) FROM VOTING_RECORD GROUP BY Election_Cycle;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Count the number of voting records for each election cycle. [/INST]

Output: SELECT Election_Cycle ,  count(*) FROM VOTING_RECORD GROUP BY Election_Cycle;


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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Which major has the most students? [/INST]

Output: SELECT Major FROM STUDENT GROUP BY major ORDER BY count(*) 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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Find the major that is studied by the largest number of students. [/INST]

Output: SELECT Major FROM STUDENT GROUP BY major ORDER BY count(*) 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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: What is the most common major among female (sex is F) students? [/INST]

Output: SELECT Major FROM STUDENT WHERE Sex  =  "F" GROUP BY major ORDER BY count(*) 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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Find the major that is studied by the most female students. [/INST]

Output: SELECT Major FROM STUDENT WHERE Sex  =  "F" GROUP BY major ORDER BY count(*) 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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: What is the city_code of the city that the most students live in? [/INST]

Output: SELECT city_code FROM STUDENT GROUP BY city_code ORDER BY count(*) 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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Return the code of the city that has the most students. [/INST]

Output: SELECT city_code FROM STUDENT GROUP BY city_code ORDER BY count(*) 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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Report the distinct advisors who have more than 2 students. [/INST]

Output: SELECT Advisor FROM STUDENT GROUP BY Advisor HAVING count(*)  >  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 ]

Voting_record :
StuID [ INT ] Voting_record.StuID = Student.StuID
Registration_Date [ TEXT ]
Election_Cycle [ TEXT ]
President_Vote [ INT ] Voting_record.President_Vote = Student.StuID
Vice_President_Vote [ INT ] Voting_record.Vice_President_Vote = Student.StuID
Secretary_Vote [ INT ] Voting_record.Secretary_Vote = Student.StuID
Treasurer_Vote [ INT ] Voting_record.Treasurer_Vote = Student.StuID
Class_President_Vote [ INT ] Voting_record.Class_President_Vote = Student.StuID
Class_Senator_Vote [ INT ] Voting_record.Class_Senator_Vote = Student.StuID

Please write me a SQL statement that answers the following question: Which advisors are advising more than 2 students? [/INST]

Output: SELECT Advisor FROM STUDENT GROUP BY Advisor HAVING count(*)  >  2;


Input:
[INST] Here is a database schema:
Ref_Characteristic_Types :
characteristic_type_code [ TEXT ] primary_key
characteristic_type_description [ TEXT ]

Ref_Colors :
color_code [ TEXT ] primary_key
color_description [ TEXT ]

Ref_Product_Categories :
product_category_code [ TEXT ] primary_key
product_category_description [ TEXT ]
unit_of_measure [ TEXT ]

Characteristics :
characteristic_id [ INT ] primary_key
characteristic_type_code [ TEXT ] Characteristics.characteristic_type_code = Ref_Characteristic_Types.characteristic_type_code
characteristic_data_type [ TEXT ]
characteristic_name [ TEXT ]
other_characteristic_details [ TEXT ]

Products :
product_id [ INT ] primary_key
color_code [ TEXT ] Products.color_code = Ref_Colors.color_code
product_category_code [ TEXT ] Products.product_category_code = Ref_Product_Categories.product_category_code
product_name [ TEXT ]
typical_buying_price [ TEXT ]
typical_selling_price [ TEXT ]
product_description [ TEXT ]
other_product_details [ TEXT ]

Product_Characteristics :
product_id [ INT ] Product_Characteristics.product_id = Products.product_id
characteristic_id [ INT ] Product_Characteristics.characteristic_id = Characteristics.characteristic_id
product_characteristic_value [ TEXT ]

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

Output: SELECT count(*) FROM products;


Input:
[INST] Here is a database schema:
Ref_Characteristic_Types :
characteristic_type_code [ TEXT ] primary_key
characteristic_type_description [ TEXT ]

Ref_Colors :
color_code [ TEXT ] primary_key
color_description [ TEXT ]

Ref_Product_Categories :
product_category_code [ TEXT ] primary_key
product_category_description [ TEXT ]
unit_of_measure [ TEXT ]

Characteristics :
characteristic_id [ INT ] primary_key
characteristic_type_code [ TEXT ] Characteristics.characteristic_type_code = Ref_Characteristic_Types.characteristic_type_code
characteristic_data_type [ TEXT ]
characteristic_name [ TEXT ]
other_characteristic_details [ TEXT ]

Products :
product_id [ INT ] primary_key
color_code [ TEXT ] Products.color_code = Ref_Colors.color_code
product_category_code [ TEXT ] Products.product_category_code = Ref_Product_Categories.product_category_code
product_name [ TEXT ]
typical_buying_price [ TEXT ]
typical_selling_price [ TEXT ]
product_description [ TEXT ]
other_product_details [ TEXT ]

Product_Characteristics :
product_id [ INT ] Product_Characteristics.product_id = Products.product_id
characteristic_id [ INT ] Product_Characteristics.characteristic_id = Characteristics.characteristic_id
product_characteristic_value [ TEXT ]

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

Output: SELECT count(*) FROM products;


Input:
[INST] Here is a database schema:
Ref_Characteristic_Types :
characteristic_type_code [ TEXT ] primary_key
characteristic_type_description [ TEXT ]

Ref_Colors :
color_code [ TEXT ] primary_key
color_description [ TEXT ]

Ref_Product_Categories :
product_category_code [ TEXT ] primary_key
product_category_description [ TEXT ]
unit_of_measure [ TEXT ]

Characteristics :
characteristic_id [ INT ] primary_key
characteristic_type_code [ TEXT ] Characteristics.characteristic_type_code = Ref_Characteristic_Types.characteristic_type_code
characteristic_data_type [ TEXT ]
characteristic_name [ TEXT ]
other_characteristic_details [ TEXT ]

Products :
product_id [ INT ] primary_key
color_code [ TEXT ] Products.color_code = Ref_Colors.color_code
product_category_code [ TEXT ] Products.product_category_code = Ref_Product_Categories.product_category_code
product_name [ TEXT ]
typical_buying_price [ TEXT ]
typical_selling_price [ TEXT ]
product_description [ TEXT ]
other_product_details [ TEXT ]

Product_Characteristics :
product_id [ INT ] Product_Characteristics.product_id = Products.product_id
characteristic_id [ INT ] Product_Characteristics.characteristic_id = Characteristics.characteristic_id
product_characteristic_value [ TEXT ]

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

Output: SELECT count(*) FROM ref_colors;


Input:
[INST] Here is a database schema:
Ref_Characteristic_Types :
characteristic_type_code [ TEXT ] primary_key
characteristic_type_description [ TEXT ]

Ref_Colors :
color_code [ TEXT ] primary_key
color_description [ TEXT ]

Ref_Product_Categories :
product_category_code [ TEXT ] primary_key
product_category_description [ TEXT ]
unit_of_measure [ TEXT ]

Characteristics :
characteristic_id [ INT ] primary_key
characteristic_type_code [ TEXT ] Characteristics.characteristic_type_code = Ref_Characteristic_Types.characteristic_type_code
characteristic_data_type [ TEXT ]
characteristic_name [ TEXT ]
other_characteristic_details [ TEXT ]

Products :
product_id [ INT ] primary_key
color_code [ TEXT ] Products.color_code = Ref_Colors.color_code
product_category_code [ TEXT ] Products.product_category_code = Ref_Product_Categories.product_category_code
product_name [ TEXT ]
typical_buying_price [ TEXT ]
typical_selling_price [ TEXT ]
product_description [ TEXT ]
other_product_details [ TEXT ]

Product_Characteristics :
product_id [ INT ] Product_Characteristics.product_id = Products.product_id
characteristic_id [ INT ] Product_Characteristics.characteristic_id = Characteristics.characteristic_id
product_characteristic_value [ TEXT ]

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

Output: SELECT count(*) FROM ref_colors;


Input:
[INST] Here is a database schema:
Ref_Characteristic_Types :
characteristic_type_code [ TEXT ] primary_key
characteristic_type_description [ TEXT ]

Ref_Colors :
color_code [ TEXT ] primary_key
color_description [ TEXT ]

Ref_Product_Categories :
product_category_code [ TEXT ] primary_key
product_category_description [ TEXT ]
unit_of_measure [ TEXT ]

Characteristics :
characteristic_id [ INT ] primary_key
characteristic_type_code [ TEXT ] Characteristics.characteristic_type_code = Ref_Characteristic_Types.characteristic_type_code
characteristic_data_type [ TEXT ]
characteristic_name [ TEXT ]
other_characteristic_details [ TEXT ]

Products :
product_id [ INT ] primary_key
color_code [ TEXT ] Products.color_code = Ref_Colors.color_code
product_category_code [ TEXT ] Products.product_category_code = Ref_Product_Categories.product_category_code
product_name [ TEXT ]
typical_buying_price [ TEXT ]
typical_selling_price [ TEXT ]
product_description [ TEXT ]
other_product_details [ TEXT ]

Product_Characteristics :
product_id [ INT ] Product_Characteristics.product_id = Products.product_id
characteristic_id [ INT ] Product_Characteristics.characteristic_id = Characteristics.characteristic_id
product_characteristic_value [ TEXT ]

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

Output: SELECT count(*) FROM CHARACTERISTICS;


Input:
[INST] Here is a database schema:
Ref_Characteristic_Types :
characteristic_type_code [ TEXT ] primary_key
characteristic_type_description [ TEXT ]

Ref_Colors :
color_code [ TEXT ] primary_key
color_description [ TEXT ]

Ref_Product_Categories :
product_category_code [ TEXT ] primary_key
product_category_description [ TEXT ]
unit_of_measure [ TEXT ]

Characteristics :
characteristic_id [ INT ] primary_key
characteristic_type_code [ TEXT ] Characteristics.characteristic_type_code = Ref_Characteristic_Types.characteristic_type_code
characteristic_data_type [ TEXT ]
characteristic_name [ TEXT ]
other_characteristic_details [ TEXT ]

Products :
product_id [ INT ] primary_key
color_code [ TEXT ] Products.color_code = Ref_Colors.color_code
product_category_code [ TEXT ] Products.product_category_code = Ref_Product_Categories.product_category_code
product_name [ TEXT ]
typical_buying_price [ TEXT ]
typical_selling_price [ TEXT ]
product_description [ TEXT ]
other_product_details [ TEXT ]

Product_Characteristics :
product_id [ INT ] Product_Characteristics.product_id = Products.product_id
characteristic_id [ INT ] Product_Characteristics.characteristic_id = Characteristics.characteristic_id
product_characteristic_value [ TEXT ]

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

Output: SELECT count(*) FROM CHARACTERISTICS;


Input:
[INST] Here is a database schema:
Ref_Characteristic_Types :
characteristic_type_code [ TEXT ] primary_key
characteristic_type_description [ TEXT ]

Ref_Colors :
color_code [ TEXT ] primary_key
color_description [ TEXT ]

Ref_Product_Categories :
product_category_code [ TEXT ] primary_key
product_category_description [ TEXT ]
unit_of_measure [ TEXT ]

Characteristics :
characteristic_id [ INT ] primary_key
characteristic_type_code [ TEXT ] Characteristics.characteristic_type_code = Ref_Characteristic_Types.characteristic_type_code
characteristic_data_type [ TEXT ]
characteristic_name [ TEXT ]
other_characteristic_details [ TEXT ]

Products :
product_id [ INT ] primary_key
color_code [ TEXT ] Products.color_code = Ref_Colors.color_code
product_category_code [ TEXT ] Products.product_category_code = Ref_Product_Categories.product_category_code
product_name [ TEXT ]
typical_buying_price [ TEXT ]
typical_selling_price [ TEXT ]
product_description [ TEXT ]
other_product_details [ TEXT ]

Product_Characteristics :
product_id [ INT ] Product_Characteristics.product_id = Products.product_id
characteristic_id [ INT ] Product_Characteristics.characteristic_id = Characteristics.characteristic_id
product_characteristic_value [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names and buying prices of all the products? [/INST]

Output: SELECT product_name ,  typical_buying_price FROM products;


Input:
[INST] Here is a database schema:
Ref_Characteristic_Types :
characteristic_type_code [ TEXT ] primary_key
characteristic_type_description [ TEXT ]

Ref_Colors :
color_code [ TEXT ] primary_key
color_description [ TEXT ]

Ref_Product_Categories :
product_category_code [ TEXT ] primary_key
product_category_description [ TEXT ]
unit_of_measure [ TEXT ]

Characteristics :
characteristic_id [ INT ] primary_key
characteristic_type_code [ TEXT ] Characteristics.characteristic_type_code = Ref_Characteristic_Types.characteristic_type_code
characteristic_data_type [ TEXT ]
characteristic_name [ TEXT ]
other_characteristic_details [ TEXT ]

Products :
product_id [ INT ] primary_key
color_code [ TEXT ] Products.color_code = Ref_Colors.color_code
product_category_code [ TEXT ] Products.product_category_code = Ref_Product_Categories.product_category_code
product_name [ TEXT ]
typical_buying_price [ TEXT ]
typical_selling_price [ TEXT ]
product_description [ TEXT ]
other_product_details [ TEXT ]

Product_Characteristics :
product_id [ INT ] Product_Characteristics.product_id = Products.product_id
characteristic_id [ INT ] Product_Characteristics.characteristic_id = Characteristics.characteristic_id
product_characteristic_value [ TEXT ]

Please write me a SQL statement that answers the following question: Return the names and typical buying prices for all products. [/INST]

Output: SELECT product_name ,  typical_buying_price FROM products;


Input:
[INST] Here is a database schema:
Ref_Characteristic_Types :
characteristic_type_code [ TEXT ] primary_key
characteristic_type_description [ TEXT ]

Ref_Colors :
color_code [ TEXT ] primary_key
color_description [ TEXT ]

Ref_Product_Categories :
product_category_code [ TEXT ] primary_key
product_category_description [ TEXT ]
unit_of_measure [ TEXT ]

Characteristics :
characteristic_id [ INT ] primary_key
characteristic_type_code [ TEXT ] Characteristics.characteristic_type_code = Ref_Characteristic_Types.characteristic_type_code
characteristic_data_type [ TEXT ]
characteristic_name [ TEXT ]
other_characteristic_details [ TEXT ]

Products :
product_id [ INT ] primary_key
color_code [ TEXT ] Products.color_code = Ref_Colors.color_code
product_category_code [ TEXT ] Products.product_category_code = Ref_Product_Categories.product_category_code
product_name [ TEXT ]
typical_buying_price [ TEXT ]
typical_selling_price [ TEXT ]
product_description [ TEXT ]
other_product_details [ TEXT ]

Product_Characteristics :
product_id [ INT ] Product_Characteristics.product_id = Products.product_id
characteristic_id [ INT ] Product_Characteristics.characteristic_id = Characteristics.characteristic_id
product_characteristic_value [ TEXT ]

Please write me a SQL statement that answers the following question: List the description of all the colors. [/INST]

Output: SELECT color_description FROM ref_colors;


Input:
[INST] Here is a database schema:
Ref_Characteristic_Types :
characteristic_type_code [ TEXT ] primary_key
characteristic_type_description [ TEXT ]

Ref_Colors :
color_code [ TEXT ] primary_key
color_description [ TEXT ]

Ref_Product_Categories :
product_category_code [ TEXT ] primary_key
product_category_description [ TEXT ]
unit_of_measure [ TEXT ]

Characteristics :
characteristic_id [ INT ] primary_key
characteristic_type_code [ TEXT ] Characteristics.characteristic_type_code = Ref_Characteristic_Types.characteristic_type_code
characteristic_data_type [ TEXT ]
characteristic_name [ TEXT ]
other_characteristic_details [ TEXT ]

Products :
product_id [ INT ] primary_key
color_code [ TEXT ] Products.color_code = Ref_Colors.color_code
product_category_code [ TEXT ] Products.product_category_code = Ref_Product_Categories.product_category_code
product_name [ TEXT ]
typical_buying_price [ TEXT ]
typical_selling_price [ TEXT ]
product_description [ TEXT ]
other_product_details [ TEXT ]

Product_Characteristics :
product_id [ INT ] Product_Characteristics.product_id = Products.product_id
characteristic_id [ INT ] Product_Characteristics.characteristic_id = Characteristics.characteristic_id
product_characteristic_value [ TEXT ]

Please write me a SQL statement that answers the following question: What are the descriptions for each color? [/INST]

Output: SELECT color_description FROM ref_colors;


Input:
[INST] Here is a database schema:
Ref_Characteristic_Types :
characteristic_type_code [ TEXT ] primary_key
characteristic_type_description [ TEXT ]

Ref_Colors :
color_code [ TEXT ] primary_key
color_description [ TEXT ]

Ref_Product_Categories :
product_category_code [ TEXT ] primary_key
product_category_description [ TEXT ]
unit_of_measure [ TEXT ]

Characteristics :
characteristic_id [ INT ] primary_key
characteristic_type_code [ TEXT ] Characteristics.characteristic_type_code = Ref_Characteristic_Types.characteristic_type_code
characteristic_data_type [ TEXT ]
characteristic_name [ TEXT ]
other_characteristic_details [ TEXT ]

Products :
product_id [ INT ] primary_key
color_code [ TEXT ] Products.color_code = Ref_Colors.color_code
product_category_code [ TEXT ] Products.product_category_code = Ref_Product_Categories.product_category_code
product_name [ TEXT ]
typical_buying_price [ TEXT ]
typical_selling_price [ TEXT ]
product_description [ TEXT ]
other_product_details [ TEXT ]

Product_Characteristics :
product_id [ INT ] Product_Characteristics.product_id = Products.product_id
characteristic_id [ INT ] Product_Characteristics.characteristic_id = Characteristics.characteristic_id
product_characteristic_value [ TEXT ]

Please write me a SQL statement that answers the following question: Find the names of all the product characteristics. [/INST]

Output: SELECT DISTINCT characteristic_name FROM CHARACTERISTICS;


Input:
[INST] Here is a database schema:
Ref_Characteristic_Types :
characteristic_type_code [ TEXT ] primary_key
characteristic_type_description [ TEXT ]

Ref_Colors :
color_code [ TEXT ] primary_key
color_description [ TEXT ]

Ref_Product_Categories :
product_category_code [ TEXT ] primary_key
product_category_description [ TEXT ]
unit_of_measure [ TEXT ]

Characteristics :
characteristic_id [ INT ] primary_key
characteristic_type_code [ TEXT ] Characteristics.characteristic_type_code = Ref_Characteristic_Types.characteristic_type_code
characteristic_data_type [ TEXT ]
characteristic_name [ TEXT ]
other_characteristic_details [ TEXT ]

Products :
product_id [ INT ] primary_key
color_code [ TEXT ] Products.color_code = Ref_Colors.color_code
product_category_code [ TEXT ] Products.product_category_code = Ref_Product_Categories.product_category_code
product_name [ TEXT ]
typical_buying_price [ TEXT ]
typical_selling_price [ TEXT ]
product_description [ TEXT ]
other_product_details [ TEXT ]

Product_Characteristics :
product_id [ INT ] Product_Characteristics.product_id = Products.product_id
characteristic_id [ INT ] Product_Characteristics.characteristic_id = Characteristics.characteristic_id
product_characteristic_value [ TEXT ]

Please write me a SQL statement that answers the following question: What are the different names of the product characteristics? [/INST]

Output: SELECT DISTINCT characteristic_name FROM CHARACTERISTICS;