human
Schema:
Student (StuID, LName, Fname, Age, Sex, Major, Advisor, city_code)
Voting_record (StuID, Registration_Date, Election_Cycle, President_Vote, Vice_President_Vote, Secretary_Vote, Treasurer_Vote, Class_President_Vote, Class_Senator_Vote)
Please answer with SQL.
assistant
Sure, I understand.
human
Which students have president votes?
assistant
SELECT DISTINCT T1.Fname , T1.Lname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.PRESIDENT_Vote;
human
How many of those students do not have advisor 2192?
assistant
SELECT COUNT( DISTINCT T1.StuID ) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.PRESIDENT_Vote WHERE T1.Advisor != '2192';
human
What are their names?
assistant
SELECT DISTINCT T1.FName , T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = PRESIDENT_Vote EXCEPT SELECT DISTINCT FName , LName FROM STUDENT WHERE Advisor = '2192';
human
Please only list last names.
assistant
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" ;