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
Find the distinct last names of all the students who have president votes and whose advisor is 8741.
assistant
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'
human
Report the distinct president vote and the vice president vote.
assistant
SELECT DISTINCT President_Vote , VICE_President_Vote FROM VOTING_RECORD
human
What are the distinct president votes on 08/30/2015?
assistant
SELECT DISTINCT PRESIDENT_Vote FROM VOTING_RECORD WHERE Registration_Date = '08/30/2015'
human
Find the distinct last names of the students who have class president votes.
assistant
SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.CLASS_President_VOTE
human
Find the number of voting records in total.
assistant
SELECT count(*) FROM VOTING_RECORD
human
Find the distinct number of president votes.
assistant
SELECT COUNT( DISTINCT President_Vote ) FROM VOTING_RECORD ;